summaryrefslogtreecommitdiffstats
path: root/components/mus/public/cpp/tests
diff options
context:
space:
mode:
Diffstat (limited to 'components/mus/public/cpp/tests')
-rw-r--r--components/mus/public/cpp/tests/run_all_unittests.cc4
-rw-r--r--components/mus/public/cpp/tests/view_manager_test_base.cc15
-rw-r--r--components/mus/public/cpp/tests/view_manager_test_base.h24
-rw-r--r--components/mus/public/cpp/tests/view_manager_test_suite.cc4
-rw-r--r--components/mus/public/cpp/tests/view_manager_test_suite.h4
-rw-r--r--components/mus/public/cpp/tests/view_unittest.cc42
6 files changed, 45 insertions, 48 deletions
diff --git a/components/mus/public/cpp/tests/run_all_unittests.cc b/components/mus/public/cpp/tests/run_all_unittests.cc
index ee82a07..3d191d4 100644
--- a/components/mus/public/cpp/tests/run_all_unittests.cc
+++ b/components/mus/public/cpp/tests/run_all_unittests.cc
@@ -7,9 +7,9 @@
#include "components/mus/public/cpp/tests/view_manager_test_suite.h"
int main(int argc, char** argv) {
- mus::ViewManagerTestSuite test_suite(argc, argv);
+ mojo::ViewManagerTestSuite test_suite(argc, argv);
return base::LaunchUnitTests(argc, argv,
- base::Bind(&mus::ViewManagerTestSuite::Run,
+ base::Bind(&mojo::ViewManagerTestSuite::Run,
base::Unretained(&test_suite)));
}
diff --git a/components/mus/public/cpp/tests/view_manager_test_base.cc b/components/mus/public/cpp/tests/view_manager_test_base.cc
index 508cd82..8ed4204 100644
--- a/components/mus/public/cpp/tests/view_manager_test_base.cc
+++ b/components/mus/public/cpp/tests/view_manager_test_base.cc
@@ -13,7 +13,7 @@
#include "components/mus/public/cpp/view_tree_host_factory.h"
#include "mojo/application/public/cpp/application_impl.h"
-namespace mus {
+namespace mojo {
namespace {
base::RunLoop* current_run_loop = nullptr;
@@ -73,13 +73,13 @@ void ViewManagerTestBase::TearDown() {
ApplicationTestBase::TearDown();
}
-mojo::ApplicationDelegate* ViewManagerTestBase::GetApplicationDelegate() {
+ApplicationDelegate* ViewManagerTestBase::GetApplicationDelegate() {
return this;
}
bool ViewManagerTestBase::ConfigureIncomingConnection(
- mojo::ApplicationConnection* connection) {
- connection->AddService<mojo::ViewTreeClient>(this);
+ ApplicationConnection* connection) {
+ connection->AddService<ViewTreeClient>(this);
return true;
}
@@ -92,10 +92,9 @@ void ViewManagerTestBase::OnConnectionLost(ViewTreeConnection* connection) {
view_tree_connection_destroyed_ = true;
}
-void ViewManagerTestBase::Create(
- mojo::ApplicationConnection* connection,
- mojo::InterfaceRequest<mojo::ViewTreeClient> request) {
+void ViewManagerTestBase::Create(ApplicationConnection* connection,
+ InterfaceRequest<ViewTreeClient> request) {
ViewTreeConnection::Create(this, request.Pass());
}
-} // namespace mus
+} // namespace mojo
diff --git a/components/mus/public/cpp/tests/view_manager_test_base.h b/components/mus/public/cpp/tests/view_manager_test_base.h
index a1529f3..15a802c 100644
--- a/components/mus/public/cpp/tests/view_manager_test_base.h
+++ b/components/mus/public/cpp/tests/view_manager_test_base.h
@@ -13,17 +13,16 @@
#include "mojo/application/public/cpp/application_test_base.h"
#include "mojo/application/public/cpp/interface_factory.h"
-namespace mus {
+namespace mojo {
// ViewManagerTestBase is a base class for use with app tests that use
// ViewManager. SetUp() connects to the ViewManager and blocks until OnEmbed()
// has been invoked. window_manager() can be used to access the ViewManager
// established as part of SetUp().
-class ViewManagerTestBase
- : public mojo::test::ApplicationTestBase,
- public mojo::ApplicationDelegate,
- public ViewTreeDelegate,
- public mojo::InterfaceFactory<mojo::ViewTreeClient> {
+class ViewManagerTestBase : public test::ApplicationTestBase,
+ public ApplicationDelegate,
+ public ViewTreeDelegate,
+ public InterfaceFactory<ViewTreeClient> {
public:
ViewManagerTestBase();
~ViewManagerTestBase() override;
@@ -54,26 +53,25 @@ class ViewManagerTestBase
void TearDown() override;
// test::ApplicationTestBase:
- mojo::ApplicationDelegate* GetApplicationDelegate() override;
+ ApplicationDelegate* GetApplicationDelegate() override;
// ApplicationDelegate:
- bool ConfigureIncomingConnection(
- mojo::ApplicationConnection* connection) override;
+ bool ConfigureIncomingConnection(ApplicationConnection* connection) override;
// ViewTreeDelegate:
void OnEmbed(View* root) override;
void OnConnectionLost(ViewTreeConnection* connection) override;
// InterfaceFactory<ViewTreeClient>:
- void Create(mojo::ApplicationConnection* connection,
- mojo::InterfaceRequest<mojo::ViewTreeClient> request) override;
+ void Create(ApplicationConnection* connection,
+ InterfaceRequest<ViewTreeClient> request) override;
// Used to receive the most recent view tree connection loaded by an embed
// action.
ViewTreeConnection* most_recent_connection_;
private:
- mojo::ViewTreeHostPtr host_;
+ ViewTreeHostPtr host_;
// The View Manager connection held by the window manager (app running at the
// root view).
@@ -84,6 +82,6 @@ class ViewManagerTestBase
MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerTestBase);
};
-} // namespace mus
+} // namespace mojo
#endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_BASE_H_
diff --git a/components/mus/public/cpp/tests/view_manager_test_suite.cc b/components/mus/public/cpp/tests/view_manager_test_suite.cc
index a1e0c98..a349ea6 100644
--- a/components/mus/public/cpp/tests/view_manager_test_suite.cc
+++ b/components/mus/public/cpp/tests/view_manager_test_suite.cc
@@ -10,7 +10,7 @@
#include "ui/gfx/x/x11_connection.h"
#endif
-namespace mus {
+namespace mojo {
ViewManagerTestSuite::ViewManagerTestSuite(int argc, char** argv)
: TestSuite(argc, argv) {}
@@ -30,4 +30,4 @@ void ViewManagerTestSuite::Initialize() {
base::i18n::AllowMultipleInitializeCallsForTesting();
}
-} // namespace mus
+} // namespace mojo
diff --git a/components/mus/public/cpp/tests/view_manager_test_suite.h b/components/mus/public/cpp/tests/view_manager_test_suite.h
index b68bb2f..7010631 100644
--- a/components/mus/public/cpp/tests/view_manager_test_suite.h
+++ b/components/mus/public/cpp/tests/view_manager_test_suite.h
@@ -8,7 +8,7 @@
#include "base/test/test_suite.h"
#include "third_party/mojo/src/mojo/public/cpp/system/macros.h"
-namespace mus {
+namespace mojo {
class ViewManagerTestSuite : public base::TestSuite {
public:
@@ -22,6 +22,6 @@ class ViewManagerTestSuite : public base::TestSuite {
MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerTestSuite);
};
-} // namespace mus
+} // namespace mojo
#endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_SUITE_H_
diff --git a/components/mus/public/cpp/tests/view_unittest.cc b/components/mus/public/cpp/tests/view_unittest.cc
index c991ca3..ca5c3b7 100644
--- a/components/mus/public/cpp/tests/view_unittest.cc
+++ b/components/mus/public/cpp/tests/view_unittest.cc
@@ -12,7 +12,7 @@
#include "components/mus/public/cpp/view_property.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace mus {
+namespace mojo {
// View ------------------------------------------------------------------------
@@ -423,7 +423,7 @@ class OrderChangeObserver : public ViewObserver {
struct Change {
View* view;
View* relative_view;
- mojo::OrderDirection direction;
+ OrderDirection direction;
};
typedef std::vector<Change> Changes;
@@ -442,13 +442,13 @@ class OrderChangeObserver : public ViewObserver {
// Overridden from ViewObserver:
void OnViewReordering(View* view,
View* relative_view,
- mojo::OrderDirection direction) override {
+ OrderDirection direction) override {
OnViewReordered(view, relative_view, direction);
}
void OnViewReordered(View* view,
View* relative_view,
- mojo::OrderDirection direction) override {
+ OrderDirection direction) override {
Change change;
change.view = view;
change.relative_view = relative_view;
@@ -488,11 +488,11 @@ TEST_F(ViewObserverTest, Order) {
ASSERT_EQ(2U, changes.size());
EXPECT_EQ(&v11, changes[0].view);
EXPECT_EQ(&v13, changes[0].relative_view);
- EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[0].direction);
+ EXPECT_EQ(ORDER_DIRECTION_ABOVE, changes[0].direction);
EXPECT_EQ(&v11, changes[1].view);
EXPECT_EQ(&v13, changes[1].relative_view);
- EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[1].direction);
+ EXPECT_EQ(ORDER_DIRECTION_ABOVE, changes[1].direction);
}
{
@@ -508,11 +508,11 @@ TEST_F(ViewObserverTest, Order) {
ASSERT_EQ(2U, changes.size());
EXPECT_EQ(&v11, changes[0].view);
EXPECT_EQ(&v12, changes[0].relative_view);
- EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[0].direction);
+ EXPECT_EQ(ORDER_DIRECTION_BELOW, changes[0].direction);
EXPECT_EQ(&v11, changes[1].view);
EXPECT_EQ(&v12, changes[1].relative_view);
- EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[1].direction);
+ EXPECT_EQ(ORDER_DIRECTION_BELOW, changes[1].direction);
}
{
@@ -520,7 +520,7 @@ TEST_F(ViewObserverTest, Order) {
// Move v11 above v12.
// Resulting order: v12. v11, v13
- v11.Reorder(&v12, mojo::ORDER_DIRECTION_ABOVE);
+ v11.Reorder(&v12, ORDER_DIRECTION_ABOVE);
EXPECT_EQ(&v12, v1.children().front());
EXPECT_EQ(&v13, v1.children().back());
@@ -528,11 +528,11 @@ TEST_F(ViewObserverTest, Order) {
ASSERT_EQ(2U, changes.size());
EXPECT_EQ(&v11, changes[0].view);
EXPECT_EQ(&v12, changes[0].relative_view);
- EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[0].direction);
+ EXPECT_EQ(ORDER_DIRECTION_ABOVE, changes[0].direction);
EXPECT_EQ(&v11, changes[1].view);
EXPECT_EQ(&v12, changes[1].relative_view);
- EXPECT_EQ(mojo::ORDER_DIRECTION_ABOVE, changes[1].direction);
+ EXPECT_EQ(ORDER_DIRECTION_ABOVE, changes[1].direction);
}
{
@@ -540,7 +540,7 @@ TEST_F(ViewObserverTest, Order) {
// Move v11 below v12.
// Resulting order: v11, v12, v13
- v11.Reorder(&v12, mojo::ORDER_DIRECTION_BELOW);
+ v11.Reorder(&v12, ORDER_DIRECTION_BELOW);
EXPECT_EQ(&v11, v1.children().front());
EXPECT_EQ(&v13, v1.children().back());
@@ -548,11 +548,11 @@ TEST_F(ViewObserverTest, Order) {
ASSERT_EQ(2U, changes.size());
EXPECT_EQ(&v11, changes[0].view);
EXPECT_EQ(&v12, changes[0].relative_view);
- EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[0].direction);
+ EXPECT_EQ(ORDER_DIRECTION_BELOW, changes[0].direction);
EXPECT_EQ(&v11, changes[1].view);
EXPECT_EQ(&v12, changes[1].relative_view);
- EXPECT_EQ(mojo::ORDER_DIRECTION_BELOW, changes[1].direction);
+ EXPECT_EQ(ORDER_DIRECTION_BELOW, changes[1].direction);
}
}
@@ -565,7 +565,7 @@ std::string ViewIdToString(Id id) {
: base::StringPrintf("%d,%d", HiWord(id), LoWord(id));
}
-std::string RectToString(const mojo::Rect& rect) {
+std::string RectToString(const Rect& rect) {
return base::StringPrintf("%d,%d %dx%d", rect.x, rect.y, rect.width,
rect.height);
}
@@ -586,16 +586,16 @@ class BoundsChangeObserver : public ViewObserver {
private:
// Overridden from ViewObserver:
void OnViewBoundsChanging(View* view,
- const mojo::Rect& old_bounds,
- const mojo::Rect& new_bounds) override {
+ const Rect& old_bounds,
+ const Rect& new_bounds) override {
changes_.push_back(base::StringPrintf(
"view=%s old_bounds=%s new_bounds=%s phase=changing",
ViewIdToString(view->id()).c_str(), RectToString(old_bounds).c_str(),
RectToString(new_bounds).c_str()));
}
void OnViewBoundsChanged(View* view,
- const mojo::Rect& old_bounds,
- const mojo::Rect& new_bounds) override {
+ const Rect& old_bounds,
+ const Rect& new_bounds) override {
changes_.push_back(base::StringPrintf(
"view=%s old_bounds=%s new_bounds=%s phase=changed",
ViewIdToString(view->id()).c_str(), RectToString(old_bounds).c_str(),
@@ -614,7 +614,7 @@ TEST_F(ViewObserverTest, SetBounds) {
TestView v1;
{
BoundsChangeObserver observer(&v1);
- mojo::Rect rect;
+ Rect rect;
rect.width = rect.height = 100;
v1.SetBounds(rect);
@@ -871,4 +871,4 @@ TEST_F(ViewObserverTest, LocalPropertyChanged) {
o.PropertyChangeInfoAndClear());
}
-} // namespace mus
+} // namespace mojo