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

Side by Side Diff: services/window_manager/window_manager_apptest.cc

Issue 858103002: Remove [Client=] annotation from ServiceProvider (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase for trybots (no code changes from ps2) Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "mojo/public/cpp/application/application_delegate.h" 7 #include "mojo/public/cpp/application/application_delegate.h"
8 #include "mojo/public/cpp/application/application_impl.h" 8 #include "mojo/public/cpp/application/application_impl.h"
9 #include "mojo/public/cpp/application/application_test_base.h" 9 #include "mojo/public/cpp/application/application_test_base.h"
10 #include "mojo/public/cpp/application/service_provider_impl.h" 10 #include "mojo/public/cpp/application/service_provider_impl.h"
(...skipping 25 matching lines...) Expand all
36 new mojo::ViewManagerClientFactory(app->shell(), this)); 36 new mojo::ViewManagerClientFactory(app->shell(), this));
37 } 37 }
38 38
39 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { 39 bool ConfigureIncomingConnection(ApplicationConnection* connection) override {
40 connection->AddService(view_manager_client_factory_.get()); 40 connection->AddService(view_manager_client_factory_.get());
41 return true; 41 return true;
42 } 42 }
43 43
44 // ViewManagerDelegate: 44 // ViewManagerDelegate:
45 void OnEmbed(View* root, 45 void OnEmbed(View* root,
46 ServiceProviderImpl* exported_services, 46 InterfaceRequest<ServiceProvider> services,
47 scoped_ptr<ServiceProvider> imported_services) override { 47 ServiceProviderPtr exposed_services) override {
48 root_ = root; 48 root_ = root;
49 embed_callback_.Run(); 49 embed_callback_.Run();
50 } 50 }
51 void OnViewManagerDisconnected(ViewManager* view_manager) override {} 51 void OnViewManagerDisconnected(ViewManager* view_manager) override {}
52 52
53 View* root_; 53 View* root_;
54 base::Closure embed_callback_; 54 base::Closure embed_callback_;
55 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_; 55 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
56 56
57 MOJO_DISALLOW_COPY_AND_ASSIGN(TestApplication); 57 MOJO_DISALLOW_COPY_AND_ASSIGN(TestApplication);
58 }; 58 };
59 59
60 class WindowManagerApplicationTest : public test::ApplicationTestBase { 60 class WindowManagerApplicationTest : public test::ApplicationTestBase {
61 public: 61 public:
62 WindowManagerApplicationTest() {} 62 WindowManagerApplicationTest() {}
63 ~WindowManagerApplicationTest() override {} 63 ~WindowManagerApplicationTest() override {}
64 64
65 protected: 65 protected:
66 // ApplicationTestBase: 66 // ApplicationTestBase:
67 void SetUp() override { 67 void SetUp() override {
68 ApplicationTestBase::SetUp(); 68 ApplicationTestBase::SetUp();
69 application_impl()->ConnectToService("mojo:window_manager", 69 application_impl()->ConnectToService("mojo:window_manager",
70 &window_manager_); 70 &window_manager_);
71 } 71 }
72 ApplicationDelegate* GetApplicationDelegate() override { 72 ApplicationDelegate* GetApplicationDelegate() override {
73 return &test_application_; 73 return &test_application_;
74 } 74 }
75 75
76 void EmbedApplicationWithURL(const std::string& url) { 76 void EmbedApplicationWithURL(const std::string& url) {
77 ServiceProviderPtr service_provider; 77 window_manager_->Embed(url, nullptr, nullptr);
78 BindToProxy(new ServiceProviderImpl, &service_provider);
79 window_manager_->Embed(
80 url, MakeRequest<ServiceProvider>(service_provider.PassMessagePipe()));
81 78
82 base::RunLoop run_loop; 79 base::RunLoop run_loop;
83 test_application_.set_embed_callback(run_loop.QuitClosure()); 80 test_application_.set_embed_callback(run_loop.QuitClosure());
84 run_loop.Run(); 81 run_loop.Run();
85 } 82 }
86 83
87 WindowManagerPtr window_manager_; 84 WindowManagerPtr window_manager_;
88 TestApplication test_application_; 85 TestApplication test_application_;
89 86
90 private: 87 private:
91 MOJO_DISALLOW_COPY_AND_ASSIGN(WindowManagerApplicationTest); 88 MOJO_DISALLOW_COPY_AND_ASSIGN(WindowManagerApplicationTest);
92 }; 89 };
93 90
94 TEST_F(WindowManagerApplicationTest, Embed) { 91 TEST_F(WindowManagerApplicationTest, Embed) {
95 EXPECT_EQ(nullptr, test_application_.root()); 92 EXPECT_EQ(nullptr, test_application_.root());
96 EmbedApplicationWithURL("mojo:window_manager_apptests"); 93 EmbedApplicationWithURL("mojo:window_manager_apptests");
97 EXPECT_NE(nullptr, test_application_.root()); 94 EXPECT_NE(nullptr, test_application_.root());
98 } 95 }
99 96
100 // TODO(msw): Write tests exercising other WindowManager functionality. 97 // TODO(msw): Write tests exercising other WindowManager functionality.
101 98
102 } // namespace 99 } // namespace
103 } // namespace mojo 100 } // namespace mojo
OLDNEW
« no previous file with comments | « services/window_manager/window_manager_app.cc ('k') | services/window_manager/window_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698