| Index: components/mus/mus_client_apptest.cc
|
| diff --git a/components/mus/view_manager_client_apptest.cc b/components/mus/mus_client_apptest.cc
|
| similarity index 93%
|
| rename from components/mus/view_manager_client_apptest.cc
|
| rename to components/mus/mus_client_apptest.cc
|
| index 8bb453193ae8d9a99b098e15cabe90a072993870..4c2b6fc130b51835131d6033da450acf59be0020 100644
|
| --- a/components/mus/view_manager_client_apptest.cc
|
| +++ b/components/mus/mus_client_apptest.cc
|
| @@ -5,7 +5,7 @@
|
| #include "base/bind.h"
|
| #include "base/logging.h"
|
| #include "base/run_loop.h"
|
| -#include "components/mus/public/cpp/tests/view_manager_test_base.h"
|
| +#include "components/mus/public/cpp/tests/mandoline_ui_services_test_base.h"
|
| #include "components/mus/public/cpp/util.h"
|
| #include "components/mus/public/cpp/view_observer.h"
|
| #include "components/mus/public/cpp/view_tree_connection.h"
|
| @@ -15,7 +15,7 @@
|
| #include "mojo/application/public/cpp/application_test_base.h"
|
| #include "ui/mojo/geometry/geometry_util.h"
|
|
|
| -namespace mojo {
|
| +namespace mus {
|
|
|
| namespace {
|
|
|
| @@ -29,10 +29,10 @@ class BoundsChangeObserver : public ViewObserver {
|
| private:
|
| // Overridden from ViewObserver:
|
| void OnViewBoundsChanged(View* view,
|
| - const Rect& old_bounds,
|
| - const Rect& new_bounds) override {
|
| + const mojo::Rect& old_bounds,
|
| + const mojo::Rect& new_bounds) override {
|
| DCHECK_EQ(view, view_);
|
| - EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop());
|
| + EXPECT_TRUE(MandolineUIServicesTestBase::QuitRunLoop());
|
| }
|
|
|
| View* view_;
|
| @@ -43,7 +43,7 @@ class BoundsChangeObserver : public ViewObserver {
|
| // Wait until the bounds of the supplied view change; returns false on timeout.
|
| bool WaitForBoundsToChange(View* view) {
|
| BoundsChangeObserver observer(view);
|
| - return ViewManagerTestBase::DoRunLoopWithTimeout();
|
| + return MandolineUIServicesTestBase::DoRunLoopWithTimeout();
|
| }
|
|
|
| // Spins a run loop until the tree beginning at |root| has |tree_size| views
|
| @@ -62,7 +62,7 @@ class TreeSizeMatchesObserver : public ViewObserver {
|
| // Overridden from ViewObserver:
|
| void OnTreeChanged(const TreeChangeParams& params) override {
|
| if (IsTreeCorrectSize())
|
| - EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop());
|
| + EXPECT_TRUE(MandolineUIServicesTestBase::QuitRunLoop());
|
| }
|
|
|
| size_t CountViews(const View* view) const {
|
| @@ -85,7 +85,7 @@ class TreeSizeMatchesObserver : public ViewObserver {
|
| bool WaitForTreeSizeToMatch(View* view, size_t tree_size) {
|
| TreeSizeMatchesObserver observer(view, tree_size);
|
| return observer.IsTreeCorrectSize() ||
|
| - ViewManagerTestBase::DoRunLoopWithTimeout();
|
| + MandolineUIServicesTestBase::DoRunLoopWithTimeout();
|
| }
|
|
|
| class OrderChangeObserver : public ViewObserver {
|
| @@ -97,9 +97,9 @@ class OrderChangeObserver : public ViewObserver {
|
| // Overridden from ViewObserver:
|
| void OnViewReordered(View* view,
|
| View* relative_view,
|
| - OrderDirection direction) override {
|
| + mojo::OrderDirection direction) override {
|
| DCHECK_EQ(view, view_);
|
| - EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop());
|
| + EXPECT_TRUE(MandolineUIServicesTestBase::QuitRunLoop());
|
| }
|
|
|
| View* view_;
|
| @@ -110,7 +110,7 @@ class OrderChangeObserver : public ViewObserver {
|
| // Wait until |view|'s tree size matches |tree_size|; returns false on timeout.
|
| bool WaitForOrderChange(ViewTreeConnection* connection, View* view) {
|
| OrderChangeObserver observer(view);
|
| - return ViewManagerTestBase::DoRunLoopWithTimeout();
|
| + return MandolineUIServicesTestBase::DoRunLoopWithTimeout();
|
| }
|
|
|
| // Tracks a view's destruction. Query is_valid() for current state.
|
| @@ -156,7 +156,7 @@ struct EmbedResult {
|
| // These tests model synchronization of two peer connections to the view manager
|
| // service, that are given access to some root view.
|
|
|
| -class ViewManagerTest : public ViewManagerTestBase {
|
| +class ViewManagerTest : public MandolineUIServicesTestBase {
|
| public:
|
| ViewManagerTest() {}
|
|
|
| @@ -170,7 +170,7 @@ class ViewManagerTest : public ViewManagerTestBase {
|
| base::Bind(&ViewManagerTest::EmbedCallbackImpl,
|
| base::Unretained(this)));
|
| embed_details_->waiting = true;
|
| - if (!ViewManagerTestBase::DoRunLoopWithTimeout())
|
| + if (!MandolineUIServicesTestBase::DoRunLoopWithTimeout())
|
| return EmbedResult();
|
| const EmbedResult result(embed_details_->connection,
|
| embed_details_->connection_id);
|
| @@ -183,23 +183,23 @@ class ViewManagerTest : public ViewManagerTestBase {
|
| mojo::ViewTreeClientPtr ConnectToApplicationAndGetViewManagerClient() {
|
| mojo::URLRequestPtr request(mojo::URLRequest::New());
|
| request->url = mojo::String::From(application_impl()->url());
|
| - scoped_ptr<ApplicationConnection> connection =
|
| + scoped_ptr<mojo::ApplicationConnection> connection =
|
| application_impl()->ConnectToApplication(request.Pass());
|
| mojo::ViewTreeClientPtr client;
|
| connection->ConnectToService(&client);
|
| return client.Pass();
|
| }
|
|
|
| - // ViewManagerTestBase:
|
| + // MandolineUIServicesTestBase:
|
| void OnEmbed(View* root) override {
|
| if (!embed_details_) {
|
| - ViewManagerTestBase::OnEmbed(root);
|
| + MandolineUIServicesTestBase::OnEmbed(root);
|
| return;
|
| }
|
|
|
| embed_details_->connection = root->connection();
|
| if (embed_details_->callback_run)
|
| - EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop());
|
| + EXPECT_TRUE(MandolineUIServicesTestBase::QuitRunLoop());
|
| }
|
|
|
| private:
|
| @@ -234,7 +234,7 @@ class ViewManagerTest : public ViewManagerTestBase {
|
| embed_details_->result = result;
|
| embed_details_->connection_id = connection_id;
|
| if (embed_details_->waiting && (!result || embed_details_->connection))
|
| - EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop());
|
| + EXPECT_TRUE(MandolineUIServicesTestBase::QuitRunLoop());
|
| }
|
|
|
| scoped_ptr<EmbedDetails> embed_details_;
|
| @@ -306,7 +306,7 @@ TEST_F(ViewManagerTest, SetBounds) {
|
| View* view_in_embedded = embedded->GetViewById(view->id());
|
| EXPECT_EQ(view->bounds(), view_in_embedded->bounds());
|
|
|
| - Rect rect;
|
| + mojo::Rect rect;
|
| rect.width = rect.height = 100;
|
| view->SetBounds(rect);
|
| ASSERT_TRUE(WaitForBoundsToChange(view_in_embedded));
|
| @@ -323,7 +323,7 @@ TEST_F(ViewManagerTest, SetBoundsSecurity) {
|
| ASSERT_NE(nullptr, embedded);
|
|
|
| View* view_in_embedded = embedded->GetViewById(view->id());
|
| - Rect rect;
|
| + mojo::Rect rect;
|
| rect.width = 800;
|
| rect.height = 600;
|
| view->SetBounds(rect);
|
| @@ -425,7 +425,7 @@ class VisibilityChangeObserver : public ViewObserver {
|
| // Overridden from ViewObserver:
|
| void OnViewVisibilityChanged(View* view) override {
|
| EXPECT_EQ(view, view_);
|
| - EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop());
|
| + EXPECT_TRUE(MandolineUIServicesTestBase::QuitRunLoop());
|
| }
|
|
|
| View* view_;
|
| @@ -453,7 +453,7 @@ TEST_F(ViewManagerTest, Visible) {
|
| {
|
| VisibilityChangeObserver observer(embedded_root);
|
| view1->SetVisible(false);
|
| - ASSERT_TRUE(ViewManagerTestBase::DoRunLoopWithTimeout());
|
| + ASSERT_TRUE(MandolineUIServicesTestBase::DoRunLoopWithTimeout());
|
| }
|
|
|
| EXPECT_FALSE(view1->visible());
|
| @@ -466,7 +466,7 @@ TEST_F(ViewManagerTest, Visible) {
|
| {
|
| VisibilityChangeObserver observer(embedded_root);
|
| view1->SetVisible(true);
|
| - ASSERT_TRUE(ViewManagerTestBase::DoRunLoopWithTimeout());
|
| + ASSERT_TRUE(MandolineUIServicesTestBase::DoRunLoopWithTimeout());
|
| }
|
|
|
| EXPECT_TRUE(view1->visible());
|
| @@ -489,7 +489,7 @@ class DrawnChangeObserver : public ViewObserver {
|
| // Overridden from ViewObserver:
|
| void OnViewDrawnChanged(View* view) override {
|
| EXPECT_EQ(view, view_);
|
| - EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop());
|
| + EXPECT_TRUE(MandolineUIServicesTestBase::QuitRunLoop());
|
| }
|
|
|
| View* view_;
|
| @@ -551,7 +551,7 @@ class FocusChangeObserver : public ViewObserver {
|
| EXPECT_FALSE(lost_focus && lost_focus->HasFocus());
|
| last_gained_focus_ = gained_focus;
|
| last_lost_focus_ = lost_focus;
|
| - EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop());
|
| + EXPECT_TRUE(MandolineUIServicesTestBase::QuitRunLoop());
|
| }
|
|
|
| View* view_;
|
| @@ -610,7 +610,7 @@ namespace {
|
|
|
| class DestroyedChangedObserver : public ViewObserver {
|
| public:
|
| - DestroyedChangedObserver(ViewManagerTestBase* test,
|
| + DestroyedChangedObserver(MandolineUIServicesTestBase* test,
|
| View* view,
|
| bool* got_destroy)
|
| : test_(test), view_(view), got_destroy_(got_destroy) {
|
| @@ -633,7 +633,7 @@ class DestroyedChangedObserver : public ViewObserver {
|
| EXPECT_FALSE(test_->view_tree_connection_destroyed());
|
| }
|
|
|
| - ViewManagerTestBase* test_;
|
| + MandolineUIServicesTestBase* test_;
|
| View* view_;
|
| bool* got_destroy_;
|
|
|
| @@ -720,7 +720,7 @@ namespace {
|
|
|
| class DestroyObserver : public ViewObserver {
|
| public:
|
| - DestroyObserver(ViewManagerTestBase* test,
|
| + DestroyObserver(MandolineUIServicesTestBase* test,
|
| ViewTreeConnection* connection,
|
| bool* got_destroy)
|
| : test_(test), got_destroy_(got_destroy) {
|
| @@ -737,10 +737,10 @@ class DestroyObserver : public ViewObserver {
|
| // We should always get OnViewDestroyed() before OnViewManagerDestroyed().
|
| EXPECT_FALSE(test_->view_tree_connection_destroyed());
|
|
|
| - EXPECT_TRUE(ViewManagerTestBase::QuitRunLoop());
|
| + EXPECT_TRUE(MandolineUIServicesTestBase::QuitRunLoop());
|
| }
|
|
|
| - ViewManagerTestBase* test_;
|
| + MandolineUIServicesTestBase* test_;
|
| bool* got_destroy_;
|
|
|
| MOJO_DISALLOW_COPY_AND_ASSIGN(DestroyObserver);
|
| @@ -772,7 +772,7 @@ TEST_F(ViewManagerTest, EmbedRootSeesHierarchyChanged) {
|
| View* embed_view = window_manager()->CreateView();
|
| window_manager()->GetRoot()->AddChild(embed_view);
|
|
|
| - embed_view->SetAccessPolicy(ViewTree::ACCESS_POLICY_EMBED_ROOT);
|
| + embed_view->SetAccessPolicy(mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT);
|
| ViewTreeConnection* vm2 = Embed(embed_view).connection;
|
| View* vm2_v1 = vm2->CreateView();
|
| vm2->GetRoot()->AddChild(vm2_v1);
|
| @@ -790,7 +790,7 @@ TEST_F(ViewManagerTest, EmbedFromEmbedRoot) {
|
| window_manager()->GetRoot()->AddChild(embed_view);
|
|
|
| // Give the connection embedded at |embed_view| embed root powers.
|
| - embed_view->SetAccessPolicy(ViewTree::ACCESS_POLICY_EMBED_ROOT);
|
| + embed_view->SetAccessPolicy(mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT);
|
| const EmbedResult result1 = Embed(embed_view);
|
| ViewTreeConnection* vm2 = result1.connection;
|
| EXPECT_EQ(result1.connection_id, vm2->GetConnectionId());
|
| @@ -821,4 +821,4 @@ TEST_F(ViewManagerTest, EmbedFromEmbedRoot) {
|
| EXPECT_EQ(result4.connection_id, result4.connection->GetConnectionId());
|
| }
|
|
|
| -} // namespace mojo
|
| +} // namespace mus
|
|
|