| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void FetchRequest( | 71 void FetchRequest( |
| 72 URLRequestPtr request, | 72 URLRequestPtr request, |
| 73 const Fetcher::FetchCallback& loader_callback) override { | 73 const Fetcher::FetchCallback& loader_callback) override { |
| 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<ContentHandler>, | 81 public InterfaceFactory<mojom::ContentHandler>, |
| 82 public ContentHandler { | 82 public mojom::ContentHandler { |
| 83 public: | 83 public: |
| 84 TestContentHandler() : app_(nullptr) {} | 84 TestContentHandler() : app_(nullptr) {} |
| 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(ApplicationImpl* app) override { |
| 90 app_ = app; | 90 app_ = app; |
| 91 } | 91 } |
| 92 bool AcceptConnection(ApplicationConnection* connection) override { | 92 bool AcceptConnection(ApplicationConnection* connection) override { |
| 93 connection->AddService<ContentHandler>(this); | 93 connection->AddService<mojom::ContentHandler>(this); |
| 94 return true; | 94 return true; |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Overridden from InterfaceFactory<ContentHandler>: | 97 // Overridden from InterfaceFactory<mojom::ContentHandler>: |
| 98 void Create(ApplicationConnection* connection, | 98 void Create(ApplicationConnection* connection, |
| 99 InterfaceRequest<ContentHandler> request) override { | 99 InterfaceRequest<mojom::ContentHandler> request) override { |
| 100 bindings_.AddBinding(this, std::move(request)); | 100 bindings_.AddBinding(this, std::move(request)); |
| 101 } | 101 } |
| 102 | 102 |
| 103 // Overridden from ContentHandler: | 103 // Overridden from mojom::ContentHandler: |
| 104 void StartApplication( | 104 void StartApplication( |
| 105 InterfaceRequest<Application> application, | 105 InterfaceRequest<mojom::Application> application, |
| 106 URLResponsePtr response, | 106 URLResponsePtr response, |
| 107 const Callback<void()>& destruct_callback) override { | 107 const Callback<void()>& destruct_callback) override { |
| 108 scoped_ptr<ApplicationDelegate> delegate(new test::TestApplication); | 108 scoped_ptr<ApplicationDelegate> delegate(new test::TestApplication); |
| 109 embedded_apps_.push_back( | 109 embedded_apps_.push_back( |
| 110 new ApplicationImpl(delegate.get(), std::move(application))); | 110 new ApplicationImpl(delegate.get(), std::move(application))); |
| 111 embedded_app_delegates_.push_back(std::move(delegate)); | 111 embedded_app_delegates_.push_back(std::move(delegate)); |
| 112 destruct_callback.Run(); | 112 destruct_callback.Run(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 ApplicationImpl* app_; | 115 ApplicationImpl* app_; |
| 116 WeakBindingSet<ContentHandler> bindings_; | 116 WeakBindingSet<mojom::ContentHandler> bindings_; |
| 117 ScopedVector<ApplicationDelegate> embedded_app_delegates_; | 117 ScopedVector<ApplicationDelegate> embedded_app_delegates_; |
| 118 ScopedVector<ApplicationImpl> embedded_apps_; | 118 ScopedVector<ApplicationImpl> embedded_apps_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(TestContentHandler); | 120 DISALLOW_COPY_AND_ASSIGN(TestContentHandler); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 } // namespace | 123 } // namespace |
| 124 | 124 |
| 125 class CapabilityFilterContentHandlerTest : public test::CapabilityFilterTest { | 125 class CapabilityFilterContentHandlerTest : public test::CapabilityFilterTest { |
| 126 public: | 126 public: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 156 RunBlockingTest(); | 156 RunBlockingTest(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 TEST_F(CapabilityFilterContentHandlerTest, Wildcards) { | 159 TEST_F(CapabilityFilterContentHandlerTest, Wildcards) { |
| 160 RunWildcardTest(); | 160 RunWildcardTest(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace test | 163 } // namespace test |
| 164 } // namespace shell | 164 } // namespace shell |
| 165 } // namespace mojo | 165 } // namespace mojo |
| OLD | NEW |