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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 return true; | 44 return true; |
45 } | 45 } |
46 | 46 |
47 // Overridden from InterfaceFactory<ContentHandler>: | 47 // Overridden from InterfaceFactory<ContentHandler>: |
48 void Create(ApplicationConnection* connection, | 48 void Create(ApplicationConnection* connection, |
49 InterfaceRequest<ContentHandler> request) override { | 49 InterfaceRequest<ContentHandler> request) override { |
50 bindings_.AddBinding(this, request.Pass()); | 50 bindings_.AddBinding(this, request.Pass()); |
51 } | 51 } |
52 | 52 |
53 // Overridden from ContentHandler: | 53 // Overridden from ContentHandler: |
54 void StartApplication(InterfaceRequest<Application> application, | 54 void StartApplication( |
55 URLResponsePtr response) override { | 55 InterfaceRequest<Application> application, |
| 56 URLResponsePtr response, |
| 57 const Callback<void()>& destruct_callback) override { |
56 response_number_++; | 58 response_number_++; |
57 latest_response_ = response.Pass(); | 59 latest_response_ = response.Pass(); |
| 60 destruct_callback.Run(); |
58 | 61 |
59 // Drop |application| request. This results in the application manager | 62 // Drop |application| request. This results in the application manager |
60 // dropping the ServiceProvider interface request provided by the client | 63 // dropping the ServiceProvider interface request provided by the client |
61 // who made the ConnectToApplication() call. Therefore the client could | 64 // who made the ConnectToApplication() call. Therefore the client could |
62 // listen for connection error of the ServiceProvider interface to learn | 65 // listen for connection error of the ServiceProvider interface to learn |
63 // that StartApplication() has been called. | 66 // that StartApplication() has been called. |
64 } | 67 } |
65 | 68 |
66 size_t response_number_; | 69 size_t response_number_; |
67 URLResponsePtr latest_response_; | 70 URLResponsePtr latest_response_; |
(...skipping 98 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 |