| 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/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 GetProxy(&service_provider); | 105 GetProxy(&service_provider); |
| 106 // This connection error handler will be called when: | 106 // This connection error handler will be called when: |
| 107 // - TestContentHandler::StartApplication() has been called (please see | 107 // - TestContentHandler::StartApplication() has been called (please see |
| 108 // comments in that method); or | 108 // comments in that method); or |
| 109 // - the application manager fails to fetch the requested URL. | 109 // - the application manager fails to fetch the requested URL. |
| 110 service_provider.set_connection_error_handler( | 110 service_provider.set_connection_error_handler( |
| 111 [&run_loop]() { run_loop.Quit(); }); | 111 [&run_loop]() { run_loop.Quit(); }); |
| 112 | 112 |
| 113 URLRequestPtr request(URLRequest::New()); | 113 URLRequestPtr request(URLRequest::New()); |
| 114 request->url = url; | 114 request->url = url; |
| 115 | 115 application_manager_->ConnectToApplication( |
| 116 scoped_ptr<shell::ConnectToApplicationParams> params( | 116 nullptr, request.Pass(), std::string(), service_provider_request.Pass(), |
| 117 new shell::ConnectToApplicationParams); | 117 nullptr, shell::CapabilityFilter(), base::Closure(), |
| 118 params->SetURLInfo(request.Pass()); | 118 shell::EmptyConnectCallback()); |
| 119 params->set_services(service_provider_request.Pass()); | |
| 120 application_manager_->ConnectToApplication(params.Pass()); | |
| 121 | 119 |
| 122 run_loop.Run(); | 120 run_loop.Run(); |
| 123 } | 121 } |
| 124 | 122 |
| 125 // Overridden from testing::Test: | 123 // Overridden from testing::Test: |
| 126 void SetUp() override { | 124 void SetUp() override { |
| 127 runner::Context::EnsureEmbedderIsInitialized(); | 125 runner::Context::EnsureEmbedderIsInitialized(); |
| 128 base::FilePath shell_dir; | 126 base::FilePath shell_dir; |
| 129 PathService::Get(base::DIR_MODULE, &shell_dir); | 127 PathService::Get(base::DIR_MODULE, &shell_dir); |
| 130 scoped_ptr<package_manager::PackageManagerImpl> package_manager( | 128 scoped_ptr<package_manager::PackageManagerImpl> package_manager( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 const URLResponse* response = html_content_handler()->latest_response(); | 167 const URLResponse* response = html_content_handler()->latest_response(); |
| 170 EXPECT_EQ("about:some_unrecognized_url", response->url); | 168 EXPECT_EQ("about:some_unrecognized_url", response->url); |
| 171 EXPECT_EQ(404u, response->status_code); | 169 EXPECT_EQ(404u, response->status_code); |
| 172 EXPECT_EQ("text/html", response->mime_type); | 170 EXPECT_EQ("text/html", response->mime_type); |
| 173 EXPECT_FALSE(response->body.is_valid()); | 171 EXPECT_FALSE(response->body.is_valid()); |
| 174 } | 172 } |
| 175 | 173 |
| 176 } // namespace | 174 } // namespace |
| 177 } // namespace fetcher | 175 } // namespace fetcher |
| 178 } // namespace mojo | 176 } // namespace mojo |
| OLD | NEW |