| 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 application_manager_->ConnectToApplication( | 115 |
| 116 nullptr, request.Pass(), std::string(), service_provider_request.Pass(), | 116 scoped_ptr<shell::ConnectToApplicationParams> params( |
| 117 nullptr, shell::CapabilityFilter(), base::Closure(), | 117 new shell::ConnectToApplicationParams); |
| 118 shell::EmptyConnectCallback()); | 118 params->SetURLInfo(request.Pass()); |
| 119 params->set_services(service_provider_request.Pass()); |
| 120 application_manager_->ConnectToApplication(params.Pass()); |
| 119 | 121 |
| 120 run_loop.Run(); | 122 run_loop.Run(); |
| 121 } | 123 } |
| 122 | 124 |
| 123 // Overridden from testing::Test: | 125 // Overridden from testing::Test: |
| 124 void SetUp() override { | 126 void SetUp() override { |
| 125 runner::Context::EnsureEmbedderIsInitialized(); | 127 runner::Context::EnsureEmbedderIsInitialized(); |
| 126 base::FilePath shell_dir; | 128 base::FilePath shell_dir; |
| 127 PathService::Get(base::DIR_MODULE, &shell_dir); | 129 PathService::Get(base::DIR_MODULE, &shell_dir); |
| 128 scoped_ptr<package_manager::PackageManagerImpl> package_manager( | 130 scoped_ptr<package_manager::PackageManagerImpl> package_manager( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const URLResponse* response = html_content_handler()->latest_response(); | 169 const URLResponse* response = html_content_handler()->latest_response(); |
| 168 EXPECT_EQ("about:some_unrecognized_url", response->url); | 170 EXPECT_EQ("about:some_unrecognized_url", response->url); |
| 169 EXPECT_EQ(404u, response->status_code); | 171 EXPECT_EQ(404u, response->status_code); |
| 170 EXPECT_EQ("text/html", response->mime_type); | 172 EXPECT_EQ("text/html", response->mime_type); |
| 171 EXPECT_FALSE(response->body.is_valid()); | 173 EXPECT_FALSE(response->body.is_valid()); |
| 172 } | 174 } |
| 173 | 175 |
| 174 } // namespace | 176 } // namespace |
| 175 } // namespace fetcher | 177 } // namespace fetcher |
| 176 } // namespace mojo | 178 } // namespace mojo |
| OLD | NEW |