| 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/test/test_io_thread.h" | 10 #include "base/test/test_io_thread.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 public: | 97 public: |
| 98 StubShellImpl(ApplicationPtr application) | 98 StubShellImpl(ApplicationPtr application) |
| 99 : application_(application.Pass()), binding_(this) { | 99 : application_(application.Pass()), binding_(this) { |
| 100 ShellPtr shell; | 100 ShellPtr shell; |
| 101 binding_.Bind(GetProxy(&shell)); | 101 binding_.Bind(GetProxy(&shell)); |
| 102 application_->Initialize(shell.Pass(), Array<String>(), ""); | 102 application_->Initialize(shell.Pass(), Array<String>(), ""); |
| 103 } | 103 } |
| 104 ~StubShellImpl() override {} | 104 ~StubShellImpl() override {} |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 void ConnectToApplication(const String& requestor_url, | 107 void ConnectToApplication(const String& app_url, |
| 108 InterfaceRequest<ServiceProvider> services, | 108 InterfaceRequest<ServiceProvider> services, |
| 109 ServiceProviderPtr exposed_services) override { | 109 ServiceProviderPtr exposed_services) override { |
| 110 application_->AcceptConnection(requestor_url, services.Pass(), | 110 application_->AcceptConnection("", services.Pass(), exposed_services.Pass(), |
| 111 exposed_services.Pass()); | 111 app_url); |
| 112 } | 112 } |
| 113 | 113 |
| 114 ApplicationPtr application_; | 114 ApplicationPtr application_; |
| 115 StrongBinding<Shell> binding_; | 115 StrongBinding<Shell> binding_; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 void DoLocalRegister(const GURL& app_url, | 118 void DoLocalRegister(const GURL& app_url, |
| 119 const std::vector<std::string>& args, | 119 const std::vector<std::string>& args, |
| 120 ApplicationPtr application) { | 120 ApplicationPtr application) { |
| 121 new StubShellImpl(application.Pass()); | 121 new StubShellImpl(application.Pass()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 144 namespace { | 144 namespace { |
| 145 | 145 |
| 146 class QuitLoopOnConnectApp : public ApplicationDelegate { | 146 class QuitLoopOnConnectApp : public ApplicationDelegate { |
| 147 public: | 147 public: |
| 148 QuitLoopOnConnectApp(const std::string& url, | 148 QuitLoopOnConnectApp(const std::string& url, |
| 149 scoped_refptr<base::TaskRunner> loop, | 149 scoped_refptr<base::TaskRunner> loop, |
| 150 base::Closure quit_callback) | 150 base::Closure quit_callback) |
| 151 : url_(url), to_quit_(loop), quit_callback_(quit_callback) {} | 151 : url_(url), to_quit_(loop), quit_callback_(quit_callback) {} |
| 152 | 152 |
| 153 private: | 153 private: |
| 154 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 154 bool ConfigureIncomingConnection(ApplicationConnection* connection, const std:
:string& url) override { |
| 155 DVLOG(1) << url_ << " accepting connection from " | 155 DVLOG(1) << url_ << " accepting connection from " |
| 156 << connection->GetRemoteApplicationURL(); | 156 << connection->GetRemoteApplicationURL(); |
| 157 to_quit_->PostTask(FROM_HERE, quit_callback_); | 157 to_quit_->PostTask(FROM_HERE, quit_callback_); |
| 158 return true; | 158 return true; |
| 159 } | 159 } |
| 160 | 160 |
| 161 const std::string url_; | 161 const std::string url_; |
| 162 scoped_refptr<base::TaskRunner> to_quit_; | 162 scoped_refptr<base::TaskRunner> to_quit_; |
| 163 base::Closure quit_callback_; | 163 base::Closure quit_callback_; |
| 164 }; | 164 }; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 run_loop.Run(); | 274 run_loop.Run(); |
| 275 | 275 |
| 276 // The apps need to be destroyed on the thread where they did socket stuff. | 276 // The apps need to be destroyed on the thread where they did socket stuff. |
| 277 io_runner()->PostTask( | 277 io_runner()->PostTask( |
| 278 FROM_HERE, base::Bind(&DestroyOnIOThread, base::Passed(&supersweet_app), | 278 FROM_HERE, base::Bind(&DestroyOnIOThread, base::Passed(&supersweet_app), |
| 279 base::Passed(&awesome_app))); | 279 base::Passed(&awesome_app))); |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace shell | 282 } // namespace shell |
| 283 } // namespace mojo | 283 } // namespace mojo |
| OLD | NEW |