提交 596e7f76 编写于 作者: S Simon Fels

Add test case for our restricted app manager

上级 0d45f800
add_subdirectory(android)
add_subdirectory(application)
add_subdirectory(support)
add_subdirectory(common)
add_subdirectory(graphics)
ANBOX_ADD_TEST(restricted_manager_tests restricted_manager_tests.cpp)
/*
* 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);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册