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

Side by Side Diff: mojo/shell/service_manager_unittest.cc

Issue 134253004: Mojo: AsyncWaiter and mojo/public/environment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing files Created 6 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 | Annotate | Revision Log
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/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "mojo/common/bindings_support_impl.h"
7 #include "mojo/public/bindings/lib/remote_ptr.h" 6 #include "mojo/public/bindings/lib/remote_ptr.h"
8 #include "mojo/shell/service_manager.h" 7 #include "mojo/shell/service_manager.h"
9 #include "mojom/shell.h" 8 #include "mojom/shell.h"
10 #include "mojom/test.h" 9 #include "mojom/test.h"
11 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
12 11
13 namespace mojo { 12 namespace mojo {
14 namespace shell { 13 namespace shell {
15 namespace { 14 namespace {
16 15
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 class ServiceManagerTest : public testing::Test, 73 class ServiceManagerTest : public testing::Test,
75 public ServiceManager::Loader { 74 public ServiceManager::Loader {
76 public: 75 public:
77 ServiceManagerTest() { 76 ServiceManagerTest() {
78 } 77 }
79 78
80 virtual ~ServiceManagerTest() { 79 virtual ~ServiceManagerTest() {
81 } 80 }
82 81
83 virtual void SetUp() OVERRIDE { 82 virtual void SetUp() OVERRIDE {
84 mojo::BindingsSupport::Set(&support_);
85 GURL test_url("test:testService"); 83 GURL test_url("test:testService");
86 service_manager_.reset(new ServiceManager); 84 service_manager_.reset(new ServiceManager);
87 service_manager_->SetLoaderForURL(this, test_url); 85 service_manager_->SetLoaderForURL(this, test_url);
88 MessagePipe pipe; 86 MessagePipe pipe;
89 test_client_.reset(new TestClientImpl(pipe.handle0.Pass())); 87 test_client_.reset(new TestClientImpl(pipe.handle0.Pass()));
90 service_manager_->Connect(test_url, pipe.handle1.Pass()); 88 service_manager_->Connect(test_url, pipe.handle1.Pass());
91 } 89 }
92 90
93 virtual void TearDown() OVERRIDE { 91 virtual void TearDown() OVERRIDE {
94 test_client_.reset(NULL); 92 test_client_.reset(NULL);
95 test_app_.reset(NULL); 93 test_app_.reset(NULL);
96 service_manager_.reset(NULL); 94 service_manager_.reset(NULL);
97 mojo::BindingsSupport::Set(NULL);
98 } 95 }
99 96
100 virtual void Load(const GURL& url, 97 virtual void Load(const GURL& url,
101 ScopedMessagePipeHandle shell_handle) OVERRIDE { 98 ScopedMessagePipeHandle shell_handle) OVERRIDE {
102 test_app_.reset(new TestApp(shell_handle.Pass())); 99 test_app_.reset(new TestApp(shell_handle.Pass()));
103 } 100 }
104 101
105 protected: 102 protected:
106 common::BindingsSupportImpl support_;
107 base::MessageLoop loop_; 103 base::MessageLoop loop_;
108 scoped_ptr<TestApp> test_app_; 104 scoped_ptr<TestApp> test_app_;
109 scoped_ptr<TestClientImpl> test_client_; 105 scoped_ptr<TestClientImpl> test_client_;
110 scoped_ptr<ServiceManager> service_manager_; 106 scoped_ptr<ServiceManager> service_manager_;
111 DISALLOW_COPY_AND_ASSIGN(ServiceManagerTest); 107 DISALLOW_COPY_AND_ASSIGN(ServiceManagerTest);
112 }; 108 };
113 109
114 TEST_F(ServiceManagerTest, Basic) { 110 TEST_F(ServiceManagerTest, Basic) {
115 test_client_->Test("test"); 111 test_client_->Test("test");
116 loop_.Run(); 112 loop_.Run();
117 EXPECT_EQ(std::string("test"), test_app_->GetLastTestString()); 113 EXPECT_EQ(std::string("test"), test_app_->GetLastTestString());
118 } 114 }
119 115
120 } // namespace 116 } // namespace
121 } // namespace shell 117 } // namespace shell
122 } // namespace mojo 118 } // namespace mojo
OLDNEW
« mojo/mojo_examples.gypi ('K') | « mojo/shell/context.cc ('k') | mojo/tools/mojob.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698