| OLD | NEW |
| 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 #include "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 base::MessageLoop::current()->QuitWhenIdle(); | 68 base::MessageLoop::current()->QuitWhenIdle(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 class TestContentHandler : public ContentHandler, public ApplicationDelegate { | 71 class TestContentHandler : public ContentHandler, public ApplicationDelegate { |
| 72 public: | 72 public: |
| 73 TestContentHandler(ApplicationConnection* connection, | 73 TestContentHandler(ApplicationConnection* connection, |
| 74 InterfaceRequest<ContentHandler> request) | 74 InterfaceRequest<ContentHandler> request) |
| 75 : binding_(this, request.Pass()) {} | 75 : binding_(this, request.Pass()) {} |
| 76 | 76 |
| 77 // ContentHandler: | 77 // ContentHandler: |
| 78 void StartApplication(InterfaceRequest<Application> application_request, | 78 void StartApplication( |
| 79 URLResponsePtr response) override { | 79 InterfaceRequest<Application> application_request, |
| 80 URLResponsePtr response, |
| 81 const Callback<void()>& destruct_callback) override { |
| 80 apps_.push_back(new ApplicationImpl(this, application_request.Pass())); | 82 apps_.push_back(new ApplicationImpl(this, application_request.Pass())); |
| 83 destruct_callback.Run(); |
| 81 } | 84 } |
| 82 | 85 |
| 83 private: | 86 private: |
| 84 StrongBinding<ContentHandler> binding_; | 87 StrongBinding<ContentHandler> binding_; |
| 85 ScopedVector<ApplicationImpl> apps_; | 88 ScopedVector<ApplicationImpl> apps_; |
| 86 | 89 |
| 87 DISALLOW_COPY_AND_ASSIGN(TestContentHandler); | 90 DISALLOW_COPY_AND_ASSIGN(TestContentHandler); |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 class TestApplicationLoader : public shell::ApplicationLoader, | 93 class TestApplicationLoader : public shell::ApplicationLoader, |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 params->SetTargetURL(GURL("test:test")); | 312 params->SetTargetURL(GURL("test:test")); |
| 310 params->set_connect_callback( | 313 params->set_connect_callback( |
| 311 [&content_handler_id](uint32_t t) { content_handler_id = t; }); | 314 [&content_handler_id](uint32_t t) { content_handler_id = t; }); |
| 312 application_manager_->ConnectToApplication(params.Pass()); | 315 application_manager_->ConnectToApplication(params.Pass()); |
| 313 EXPECT_EQ(0u, content_handler_id); | 316 EXPECT_EQ(0u, content_handler_id); |
| 314 } | 317 } |
| 315 | 318 |
| 316 } // namespace test | 319 } // namespace test |
| 317 } // namespace package_manager | 320 } // namespace package_manager |
| 318 } // namespace mojo | 321 } // namespace mojo |
| OLD | NEW |