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/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.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 "mojo/application/public/cpp/application_connection.h" | 10 #include "mojo/application/public/cpp/application_connection.h" |
11 #include "mojo/application/public/cpp/application_delegate.h" | 11 #include "mojo/application/public/cpp/application_delegate.h" |
12 #include "mojo/application/public/cpp/application_impl.h" | 12 #include "mojo/application/public/cpp/application_impl.h" |
13 #include "mojo/application/public/cpp/interface_factory.h" | 13 #include "mojo/application/public/cpp/interface_factory.h" |
14 #include "mojo/application/public/interfaces/content_handler.mojom.h" | 14 #include "mojo/application/public/interfaces/content_handler.mojom.h" |
15 #include "mojo/common/weak_binding_set.h" | 15 #include "mojo/common/weak_binding_set.h" |
16 #include "mojo/runner/about_fetcher.h" | 16 #include "mojo/runner/about_fetcher.h" |
| 17 #include "mojo/runner/context.h" |
17 #include "mojo/shell/application_loader.h" | 18 #include "mojo/shell/application_loader.h" |
18 #include "mojo/shell/application_manager.h" | 19 #include "mojo/shell/application_manager.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 | 21 |
21 namespace mojo { | 22 namespace mojo { |
22 namespace runner { | 23 namespace runner { |
23 namespace { | 24 namespace { |
24 | 25 |
25 class TestContentHandler : public ApplicationDelegate, | 26 class TestContentHandler : public ApplicationDelegate, |
26 public InterfaceFactory<ContentHandler>, | 27 public InterfaceFactory<ContentHandler>, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 application_manager_->ConnectToApplication( | 136 application_manager_->ConnectToApplication( |
136 nullptr, request.Pass(), std::string(), GURL(), | 137 nullptr, request.Pass(), std::string(), GURL(), |
137 service_provider_request.Pass(), nullptr, shell::CapabilityFilter(), | 138 service_provider_request.Pass(), nullptr, shell::CapabilityFilter(), |
138 base::Closure()); | 139 base::Closure()); |
139 | 140 |
140 run_loop.Run(); | 141 run_loop.Run(); |
141 } | 142 } |
142 | 143 |
143 // Overridden from testing::Test: | 144 // Overridden from testing::Test: |
144 void SetUp() override { | 145 void SetUp() override { |
| 146 Context::EnsureEmbedderIsInitialized(); |
145 application_manager_.reset(new shell::ApplicationManager(&test_delegate_)); | 147 application_manager_.reset(new shell::ApplicationManager(&test_delegate_)); |
146 application_manager_->SetLoaderForURL( | 148 application_manager_->SetLoaderForURL( |
147 make_scoped_ptr(new TestLoader(&html_content_handler_)), | 149 make_scoped_ptr(new TestLoader(&html_content_handler_)), |
148 GURL("test:html_content_handler")); | 150 GURL("test:html_content_handler")); |
149 application_manager_->RegisterContentHandler( | 151 application_manager_->RegisterContentHandler( |
150 "text/html", GURL("test:html_content_handler")); | 152 "text/html", GURL("test:html_content_handler")); |
151 } | 153 } |
152 | 154 |
153 void TearDown() override { application_manager_.reset(); } | 155 void TearDown() override { application_manager_.reset(); } |
154 | 156 |
(...skipping 21 matching lines...) Expand all Loading... |
176 | 178 |
177 TEST_F(AboutFetcherTest, UnrecognizedURL) { | 179 TEST_F(AboutFetcherTest, UnrecognizedURL) { |
178 ConnectAndWait("about:some_unrecognized_url"); | 180 ConnectAndWait("about:some_unrecognized_url"); |
179 | 181 |
180 ASSERT_EQ(0u, html_content_handler()->response_number()); | 182 ASSERT_EQ(0u, html_content_handler()->response_number()); |
181 } | 183 } |
182 | 184 |
183 } // namespace | 185 } // namespace |
184 } // namespace runner | 186 } // namespace runner |
185 } // namespace mojo | 187 } // namespace mojo |
OLD | NEW |