| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 new TestFetcher(GURL(request->url.get()), loader_callback); | 74 new TestFetcher(GURL(request->url.get()), loader_callback); |
| 75 } | 75 } |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(TestPackageManager); | 77 DISALLOW_COPY_AND_ASSIGN(TestPackageManager); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 class TestContentHandler : public ApplicationDelegate, | 80 class TestContentHandler : public ApplicationDelegate, |
| 81 public InterfaceFactory<mojom::ContentHandler>, | 81 public InterfaceFactory<mojom::ContentHandler>, |
| 82 public mojom::ContentHandler { | 82 public mojom::ContentHandler { |
| 83 public: | 83 public: |
| 84 TestContentHandler() : app_(nullptr) {} | 84 TestContentHandler() {} |
| 85 ~TestContentHandler() override {} | 85 ~TestContentHandler() override {} |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 // Overridden from ApplicationDelegate: | 88 // Overridden from ApplicationDelegate: |
| 89 void Initialize(ApplicationImpl* app) override { | 89 void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} |
| 90 app_ = app; | |
| 91 } | |
| 92 bool AcceptConnection(ApplicationConnection* connection) override { | 90 bool AcceptConnection(ApplicationConnection* connection) override { |
| 93 connection->AddService<mojom::ContentHandler>(this); | 91 connection->AddService<mojom::ContentHandler>(this); |
| 94 return true; | 92 return true; |
| 95 } | 93 } |
| 96 | 94 |
| 97 // Overridden from InterfaceFactory<mojom::ContentHandler>: | 95 // Overridden from InterfaceFactory<mojom::ContentHandler>: |
| 98 void Create(ApplicationConnection* connection, | 96 void Create(ApplicationConnection* connection, |
| 99 InterfaceRequest<mojom::ContentHandler> request) override { | 97 InterfaceRequest<mojom::ContentHandler> request) override { |
| 100 bindings_.AddBinding(this, std::move(request)); | 98 bindings_.AddBinding(this, std::move(request)); |
| 101 } | 99 } |
| 102 | 100 |
| 103 // Overridden from mojom::ContentHandler: | 101 // Overridden from mojom::ContentHandler: |
| 104 void StartApplication( | 102 void StartApplication( |
| 105 InterfaceRequest<mojom::Application> application, | 103 InterfaceRequest<mojom::Application> application, |
| 106 URLResponsePtr response, | 104 URLResponsePtr response, |
| 107 const Callback<void()>& destruct_callback) override { | 105 const Callback<void()>& destruct_callback) override { |
| 108 scoped_ptr<ApplicationDelegate> delegate(new test::TestApplication); | 106 scoped_ptr<ApplicationDelegate> delegate(new test::TestApplication); |
| 109 embedded_apps_.push_back( | 107 embedded_apps_.push_back( |
| 110 new ApplicationImpl(delegate.get(), std::move(application))); | 108 new ApplicationImpl(delegate.get(), std::move(application))); |
| 111 embedded_app_delegates_.push_back(std::move(delegate)); | 109 embedded_app_delegates_.push_back(std::move(delegate)); |
| 112 destruct_callback.Run(); | 110 destruct_callback.Run(); |
| 113 } | 111 } |
| 114 | 112 |
| 115 ApplicationImpl* app_; | |
| 116 WeakBindingSet<mojom::ContentHandler> bindings_; | 113 WeakBindingSet<mojom::ContentHandler> bindings_; |
| 117 ScopedVector<ApplicationDelegate> embedded_app_delegates_; | 114 ScopedVector<ApplicationDelegate> embedded_app_delegates_; |
| 118 ScopedVector<ApplicationImpl> embedded_apps_; | 115 ScopedVector<ApplicationImpl> embedded_apps_; |
| 119 | 116 |
| 120 DISALLOW_COPY_AND_ASSIGN(TestContentHandler); | 117 DISALLOW_COPY_AND_ASSIGN(TestContentHandler); |
| 121 }; | 118 }; |
| 122 | 119 |
| 123 } // namespace | 120 } // namespace |
| 124 | 121 |
| 125 class CapabilityFilterContentHandlerTest : public test::CapabilityFilterTest { | 122 class CapabilityFilterContentHandlerTest : public test::CapabilityFilterTest { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 156 RunBlockingTest(); | 153 RunBlockingTest(); |
| 157 } | 154 } |
| 158 | 155 |
| 159 TEST_F(CapabilityFilterContentHandlerTest, Wildcards) { | 156 TEST_F(CapabilityFilterContentHandlerTest, Wildcards) { |
| 160 RunWildcardTest(); | 157 RunWildcardTest(); |
| 161 } | 158 } |
| 162 | 159 |
| 163 } // namespace test | 160 } // namespace test |
| 164 } // namespace shell | 161 } // namespace shell |
| 165 } // namespace mojo | 162 } // namespace mojo |
| OLD | NEW |