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