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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 ServiceProviderPtr service_provider; | 103 ServiceProviderPtr service_provider; |
104 InterfaceRequest<ServiceProvider> service_provider_request = | 104 InterfaceRequest<ServiceProvider> service_provider_request = |
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()); |
| 114 request->url = url; |
| 115 |
113 scoped_ptr<shell::ConnectToApplicationParams> params( | 116 scoped_ptr<shell::ConnectToApplicationParams> params( |
114 new shell::ConnectToApplicationParams); | 117 new shell::ConnectToApplicationParams); |
115 params->SetTargetURL(GURL(url)); | 118 params->SetURLInfo(request.Pass()); |
116 params->set_services(service_provider_request.Pass()); | 119 params->set_services(service_provider_request.Pass()); |
117 application_manager_->ConnectToApplication(params.Pass()); | 120 application_manager_->ConnectToApplication(params.Pass()); |
118 | 121 |
119 run_loop.Run(); | 122 run_loop.Run(); |
120 } | 123 } |
121 | 124 |
122 // Overridden from testing::Test: | 125 // Overridden from testing::Test: |
123 void SetUp() override { | 126 void SetUp() override { |
124 runner::Context::EnsureEmbedderIsInitialized(); | 127 runner::Context::EnsureEmbedderIsInitialized(); |
125 base::FilePath shell_dir; | 128 base::FilePath shell_dir; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 const URLResponse* response = html_content_handler()->latest_response(); | 169 const URLResponse* response = html_content_handler()->latest_response(); |
167 EXPECT_EQ("about:some_unrecognized_url", response->url); | 170 EXPECT_EQ("about:some_unrecognized_url", response->url); |
168 EXPECT_EQ(404u, response->status_code); | 171 EXPECT_EQ(404u, response->status_code); |
169 EXPECT_EQ("text/html", response->mime_type); | 172 EXPECT_EQ("text/html", response->mime_type); |
170 EXPECT_FALSE(response->body.is_valid()); | 173 EXPECT_FALSE(response->body.is_valid()); |
171 } | 174 } |
172 | 175 |
173 } // namespace | 176 } // namespace |
174 } // namespace fetcher | 177 } // namespace fetcher |
175 } // namespace mojo | 178 } // namespace mojo |
OLD | NEW |