2 * Copyright (C) 2017 Simon Fels <morphis@gravedo.de>
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "anbox/application/manager.h"
20 #include <gmock/gmock.h>
22 using namespace ::testing;
25 class MockManager : public anbox::application::Manager {
27 MOCK_METHOD3(launch, void(const anbox::android::Intent&,
28 const anbox::graphics::Rect&,
29 const anbox::wm::Stack::Id&));
30 MOCK_METHOD0(ready, core::Property<bool>&());
34 TEST(RestrictedManager, RedirectsLaunchesToRightStack) {
35 auto mgr = std::make_shared<MockManager>();
36 anbox::application::RestrictedManager restricted_mgr(mgr, anbox::wm::Stack::Id::Freeform);
38 EXPECT_CALL(*mgr, launch(_, _, anbox::wm::Stack::Id::Freeform))
41 restricted_mgr.launch(anbox::android::Intent{},
42 anbox::graphics::Rect::Empty,
43 anbox::wm::Stack::Id::Default);
45 restricted_mgr.launch(anbox::android::Intent{},
46 anbox::graphics::Rect::Empty,
47 anbox::wm::Stack::Id::Fullscreen);
49 restricted_mgr.launch(anbox::android::Intent{},
50 anbox::graphics::Rect::Empty,
51 anbox::wm::Stack::Id::Invalid);
53 restricted_mgr.launch(anbox::android::Intent{},
54 anbox::graphics::Rect::Empty,
55 anbox::wm::Stack::Id::Freeform);