Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: components/mus/public/cpp/tests/view_manager_test_base.h

Issue 1351013002: Revert of Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_BASE_H_ 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_BASE_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_BASE_H_ 6 #define COMPONENTS_MUS_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_BASE_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "components/mus/public/cpp/view_tree_delegate.h" 9 #include "components/mus/public/cpp/view_tree_delegate.h"
10 #include "components/mus/public/interfaces/view_tree.mojom.h" 10 #include "components/mus/public/interfaces/view_tree.mojom.h"
11 #include "components/mus/public/interfaces/view_tree_host.mojom.h" 11 #include "components/mus/public/interfaces/view_tree_host.mojom.h"
12 #include "mojo/application/public/cpp/application_delegate.h" 12 #include "mojo/application/public/cpp/application_delegate.h"
13 #include "mojo/application/public/cpp/application_test_base.h" 13 #include "mojo/application/public/cpp/application_test_base.h"
14 #include "mojo/application/public/cpp/interface_factory.h" 14 #include "mojo/application/public/cpp/interface_factory.h"
15 15
16 namespace mus { 16 namespace mojo {
17 17
18 // ViewManagerTestBase is a base class for use with app tests that use 18 // ViewManagerTestBase is a base class for use with app tests that use
19 // ViewManager. SetUp() connects to the ViewManager and blocks until OnEmbed() 19 // ViewManager. SetUp() connects to the ViewManager and blocks until OnEmbed()
20 // has been invoked. window_manager() can be used to access the ViewManager 20 // has been invoked. window_manager() can be used to access the ViewManager
21 // established as part of SetUp(). 21 // established as part of SetUp().
22 class ViewManagerTestBase 22 class ViewManagerTestBase : public test::ApplicationTestBase,
23 : public mojo::test::ApplicationTestBase, 23 public ApplicationDelegate,
24 public mojo::ApplicationDelegate, 24 public ViewTreeDelegate,
25 public ViewTreeDelegate, 25 public InterfaceFactory<ViewTreeClient> {
26 public mojo::InterfaceFactory<mojo::ViewTreeClient> {
27 public: 26 public:
28 ViewManagerTestBase(); 27 ViewManagerTestBase();
29 ~ViewManagerTestBase() override; 28 ~ViewManagerTestBase() override;
30 29
31 // True if ViewTreeDelegate::OnConnectionLost() was called. 30 // True if ViewTreeDelegate::OnConnectionLost() was called.
32 bool view_tree_connection_destroyed() const { 31 bool view_tree_connection_destroyed() const {
33 return view_tree_connection_destroyed_; 32 return view_tree_connection_destroyed_;
34 } 33 }
35 34
36 // Runs the MessageLoop until QuitRunLoop() is called, or a timeout occurs. 35 // Runs the MessageLoop until QuitRunLoop() is called, or a timeout occurs.
(...skipping 10 matching lines...) Expand all
47 protected: 46 protected:
48 ViewTreeConnection* most_recent_connection() { 47 ViewTreeConnection* most_recent_connection() {
49 return most_recent_connection_; 48 return most_recent_connection_;
50 } 49 }
51 50
52 // testing::Test: 51 // testing::Test:
53 void SetUp() override; 52 void SetUp() override;
54 void TearDown() override; 53 void TearDown() override;
55 54
56 // test::ApplicationTestBase: 55 // test::ApplicationTestBase:
57 mojo::ApplicationDelegate* GetApplicationDelegate() override; 56 ApplicationDelegate* GetApplicationDelegate() override;
58 57
59 // ApplicationDelegate: 58 // ApplicationDelegate:
60 bool ConfigureIncomingConnection( 59 bool ConfigureIncomingConnection(ApplicationConnection* connection) override;
61 mojo::ApplicationConnection* connection) override;
62 60
63 // ViewTreeDelegate: 61 // ViewTreeDelegate:
64 void OnEmbed(View* root) override; 62 void OnEmbed(View* root) override;
65 void OnConnectionLost(ViewTreeConnection* connection) override; 63 void OnConnectionLost(ViewTreeConnection* connection) override;
66 64
67 // InterfaceFactory<ViewTreeClient>: 65 // InterfaceFactory<ViewTreeClient>:
68 void Create(mojo::ApplicationConnection* connection, 66 void Create(ApplicationConnection* connection,
69 mojo::InterfaceRequest<mojo::ViewTreeClient> request) override; 67 InterfaceRequest<ViewTreeClient> request) override;
70 68
71 // Used to receive the most recent view tree connection loaded by an embed 69 // Used to receive the most recent view tree connection loaded by an embed
72 // action. 70 // action.
73 ViewTreeConnection* most_recent_connection_; 71 ViewTreeConnection* most_recent_connection_;
74 72
75 private: 73 private:
76 mojo::ViewTreeHostPtr host_; 74 ViewTreeHostPtr host_;
77 75
78 // The View Manager connection held by the window manager (app running at the 76 // The View Manager connection held by the window manager (app running at the
79 // root view). 77 // root view).
80 ViewTreeConnection* window_manager_; 78 ViewTreeConnection* window_manager_;
81 79
82 bool view_tree_connection_destroyed_; 80 bool view_tree_connection_destroyed_;
83 81
84 MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerTestBase); 82 MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerTestBase);
85 }; 83 };
86 84
87 } // namespace mus 85 } // namespace mojo
88 86
89 #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_BASE_H_ 87 #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_VIEW_MANAGER_TEST_BASE_H_
OLDNEW
« no previous file with comments | « components/mus/public/cpp/tests/run_all_unittests.cc ('k') | components/mus/public/cpp/tests/view_manager_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698