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 "mojo/shell/fetcher/about_fetcher.h" | 5 #include "mojo/shell/fetcher/about_fetcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 TestContentHandler() : response_number_(0) {} | 36 TestContentHandler() : response_number_(0) {} |
37 ~TestContentHandler() override {} | 37 ~TestContentHandler() override {} |
38 | 38 |
39 size_t response_number() const { return response_number_; } | 39 size_t response_number() const { return response_number_; } |
40 const URLResponse* latest_response() const { return latest_response_.get(); } | 40 const URLResponse* latest_response() const { return latest_response_.get(); } |
41 | 41 |
42 private: | 42 private: |
43 // Overridden from ShellClient: | 43 // Overridden from ShellClient: |
44 void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} | 44 void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} |
45 bool AcceptConnection(Connection* connection) override { | 45 bool AcceptConnection(Connection* connection) override { |
46 connection->AddService<mojom::ContentHandler>(this); | 46 connection->AddInterface<mojom::ContentHandler>(this); |
47 return true; | 47 return true; |
48 } | 48 } |
49 | 49 |
50 // Overridden from InterfaceFactory<mojom::ContentHandler>: | 50 // Overridden from InterfaceFactory<mojom::ContentHandler>: |
51 void Create(Connection* connection, | 51 void Create(Connection* connection, |
52 InterfaceRequest<mojom::ContentHandler> request) override { | 52 InterfaceRequest<mojom::ContentHandler> request) override { |
53 bindings_.AddBinding(this, std::move(request)); | 53 bindings_.AddBinding(this, std::move(request)); |
54 } | 54 } |
55 | 55 |
56 // Overridden from mojom::ContentHandler: | 56 // Overridden from mojom::ContentHandler: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 const URLResponse* response = html_content_handler()->latest_response(); | 172 const URLResponse* response = html_content_handler()->latest_response(); |
173 EXPECT_EQ("about:some_unrecognized_url", response->url); | 173 EXPECT_EQ("about:some_unrecognized_url", response->url); |
174 EXPECT_EQ(404u, response->status_code); | 174 EXPECT_EQ(404u, response->status_code); |
175 EXPECT_EQ("text/html", response->mime_type); | 175 EXPECT_EQ("text/html", response->mime_type); |
176 EXPECT_FALSE(response->body.is_valid()); | 176 EXPECT_FALSE(response->body.is_valid()); |
177 } | 177 } |
178 | 178 |
179 } // namespace | 179 } // namespace |
180 } // namespace shell | 180 } // namespace shell |
181 } // namespace mojo | 181 } // namespace mojo |
OLD | NEW |