Merge pull request #340 from morphis/f/add-tests-for-restricted-app-mgr
Add test case for our restricted app manager
This commit is contained in:
commit
98deffd895
3 changed files with 58 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
add_subdirectory(android)
|
add_subdirectory(android)
|
||||||
|
add_subdirectory(application)
|
||||||
add_subdirectory(support)
|
add_subdirectory(support)
|
||||||
add_subdirectory(common)
|
add_subdirectory(common)
|
||||||
add_subdirectory(graphics)
|
add_subdirectory(graphics)
|
||||||
|
|
|
||||||
1
tests/anbox/application/CMakeLists.txt
Normal file
1
tests/anbox/application/CMakeLists.txt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
ANBOX_ADD_TEST(restricted_manager_tests restricted_manager_tests.cpp)
|
||||||
56
tests/anbox/application/restricted_manager_tests.cpp
Normal file
56
tests/anbox/application/restricted_manager_tests.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Simon Fels <morphis@gravedo.de>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 3, as published
|
||||||
|
* by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranties of
|
||||||
|
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "anbox/application/manager.h"
|
||||||
|
|
||||||
|
#include <gmock/gmock.h>
|
||||||
|
|
||||||
|
using namespace ::testing;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
class MockManager : public anbox::application::Manager {
|
||||||
|
public:
|
||||||
|
MOCK_METHOD3(launch, void(const anbox::android::Intent&,
|
||||||
|
const anbox::graphics::Rect&,
|
||||||
|
const anbox::wm::Stack::Id&));
|
||||||
|
MOCK_METHOD0(ready, core::Property<bool>&());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(RestrictedManager, RedirectsLaunchesToRightStack) {
|
||||||
|
auto mgr = std::make_shared<MockManager>();
|
||||||
|
anbox::application::RestrictedManager restricted_mgr(mgr, anbox::wm::Stack::Id::Freeform);
|
||||||
|
|
||||||
|
EXPECT_CALL(*mgr, launch(_, _, anbox::wm::Stack::Id::Freeform))
|
||||||
|
.Times(4);
|
||||||
|
|
||||||
|
restricted_mgr.launch(anbox::android::Intent{},
|
||||||
|
anbox::graphics::Rect::Empty,
|
||||||
|
anbox::wm::Stack::Id::Default);
|
||||||
|
|
||||||
|
restricted_mgr.launch(anbox::android::Intent{},
|
||||||
|
anbox::graphics::Rect::Empty,
|
||||||
|
anbox::wm::Stack::Id::Fullscreen);
|
||||||
|
|
||||||
|
restricted_mgr.launch(anbox::android::Intent{},
|
||||||
|
anbox::graphics::Rect::Empty,
|
||||||
|
anbox::wm::Stack::Id::Invalid);
|
||||||
|
|
||||||
|
restricted_mgr.launch(anbox::android::Intent{},
|
||||||
|
anbox::graphics::Rect::Empty,
|
||||||
|
anbox::wm::Stack::Id::Freeform);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue