OLD | NEW |
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/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "mojo/application_manager/application_loader.h" | 8 #include "mojo/application_manager/application_loader.h" |
9 #include "mojo/application_manager/application_manager.h" | 9 #include "mojo/application_manager/application_manager.h" |
10 #include "mojo/application_manager/background_shell_application_loader.h" | 10 #include "mojo/application_manager/background_shell_application_loader.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 private: | 111 private: |
112 // ApplicationLoader implementation. | 112 // ApplicationLoader implementation. |
113 virtual void Load(ApplicationManager* manager, | 113 virtual void Load(ApplicationManager* manager, |
114 const GURL& url, | 114 const GURL& url, |
115 scoped_refptr<LoadCallbacks> callbacks) OVERRIDE { | 115 scoped_refptr<LoadCallbacks> callbacks) OVERRIDE { |
116 ++num_loads_; | 116 ++num_loads_; |
117 test_app_.reset( | 117 test_app_.reset( |
118 new ApplicationImpl(this, callbacks->RegisterApplication().Pass())); | 118 new ApplicationImpl(this, callbacks->RegisterApplication().Pass())); |
119 } | 119 } |
120 | 120 |
121 virtual void OnServiceError(ApplicationManager* manager, | 121 virtual void OnApplicationError(ApplicationManager* manager, |
122 const GURL& url) OVERRIDE {} | 122 const GURL& url) OVERRIDE {} |
123 | 123 |
124 // ApplicationDelegate implementation. | 124 // ApplicationDelegate implementation. |
125 virtual bool ConfigureIncomingConnection( | 125 virtual bool ConfigureIncomingConnection( |
126 ApplicationConnection* connection) OVERRIDE { | 126 ApplicationConnection* connection) OVERRIDE { |
127 connection->AddService(this); | 127 connection->AddService(this); |
128 return true; | 128 return true; |
129 } | 129 } |
130 | 130 |
131 // InterfaceFactory implementation. | 131 // InterfaceFactory implementation. |
132 virtual void Create(ApplicationConnection* connection, | 132 virtual void Create(ApplicationConnection* connection, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 virtual ~Tester() {} | 322 virtual ~Tester() {} |
323 | 323 |
324 private: | 324 private: |
325 virtual void Load(ApplicationManager* manager, | 325 virtual void Load(ApplicationManager* manager, |
326 const GURL& url, | 326 const GURL& url, |
327 scoped_refptr<LoadCallbacks> callbacks) OVERRIDE { | 327 scoped_refptr<LoadCallbacks> callbacks) OVERRIDE { |
328 app_.reset( | 328 app_.reset( |
329 new ApplicationImpl(this, callbacks->RegisterApplication().Pass())); | 329 new ApplicationImpl(this, callbacks->RegisterApplication().Pass())); |
330 } | 330 } |
331 | 331 |
332 virtual void OnServiceError(ApplicationManager* manager, | 332 virtual void OnApplicationError(ApplicationManager* manager, |
333 const GURL& url) OVERRIDE {} | 333 const GURL& url) OVERRIDE {} |
334 | 334 |
335 virtual bool ConfigureIncomingConnection( | 335 virtual bool ConfigureIncomingConnection( |
336 ApplicationConnection* connection) OVERRIDE { | 336 ApplicationConnection* connection) OVERRIDE { |
337 if (!requestor_url_.empty() && | 337 if (!requestor_url_.empty() && |
338 requestor_url_ != connection->GetRemoteApplicationURL()) { | 338 requestor_url_ != connection->GetRemoteApplicationURL()) { |
339 context_->set_tester_called_quit(); | 339 context_->set_tester_called_quit(); |
340 context_->QuitSoon(); | 340 context_->QuitSoon(); |
341 base::MessageLoop::current()->Quit(); | 341 base::MessageLoop::current()->Quit(); |
342 return false; | 342 return false; |
343 } | 343 } |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 std::string url("test:test3"); | 634 std::string url("test:test3"); |
635 TestServicePtr test_service; | 635 TestServicePtr test_service; |
636 application_manager_->ConnectToService(GURL(url), &test_service); | 636 application_manager_->ConnectToService(GURL(url), &test_service); |
637 | 637 |
638 EXPECT_EQ(1, interceptor.call_count()); | 638 EXPECT_EQ(1, interceptor.call_count()); |
639 EXPECT_EQ(url, interceptor.url_spec()); | 639 EXPECT_EQ(url, interceptor.url_spec()); |
640 EXPECT_EQ(1, default_loader->num_loads()); | 640 EXPECT_EQ(1, default_loader->num_loads()); |
641 } | 641 } |
642 | 642 |
643 } // namespace mojo | 643 } // namespace mojo |
OLD | NEW |