Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: mojo/shell/fetcher/about_fetcher_unittest.cc

Issue 1684783002: Rename ServiceProvider to InterfaceProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/shell/connect_util.cc ('k') | mojo/shell/package_manager/content_handler_connection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // Overridden from mojom::ContentHandler: 56 // Overridden from mojom::ContentHandler:
57 void StartApplication( 57 void StartApplication(
58 InterfaceRequest<mojom::ShellClient> request, 58 InterfaceRequest<mojom::ShellClient> request,
59 URLResponsePtr response, 59 URLResponsePtr response,
60 const Callback<void()>& destruct_callback) override { 60 const Callback<void()>& destruct_callback) override {
61 response_number_++; 61 response_number_++;
62 latest_response_ = std::move(response); 62 latest_response_ = std::move(response);
63 destruct_callback.Run(); 63 destruct_callback.Run();
64 64
65 // Drop |application| request. This results in the application manager 65 // Drop |application| request. This results in the application manager
66 // dropping the ServiceProvider interface request provided by the client 66 // dropping the InterfaceProvider interface request provided by the client
67 // who made the ConnectToApplication() call. Therefore the client could 67 // who made the ConnectToApplication() call. Therefore the client could
68 // listen for connection error of the ServiceProvider interface to learn 68 // listen for connection error of the InterfaceProvider interface to learn
69 // that StartApplication() has been called. 69 // that StartApplication() has been called.
70 } 70 }
71 71
72 size_t response_number_; 72 size_t response_number_;
73 URLResponsePtr latest_response_; 73 URLResponsePtr latest_response_;
74 WeakBindingSet<mojom::ContentHandler> bindings_; 74 WeakBindingSet<mojom::ContentHandler> bindings_;
75 75
76 DISALLOW_COPY_AND_ASSIGN(TestContentHandler); 76 DISALLOW_COPY_AND_ASSIGN(TestContentHandler);
77 }; 77 };
78 78
(...skipping 21 matching lines...) Expand all
100 ~AboutFetcherTest() override {} 100 ~AboutFetcherTest() override {}
101 101
102 protected: 102 protected:
103 const TestContentHandler* html_content_handler() const { 103 const TestContentHandler* html_content_handler() const {
104 return &html_content_handler_; 104 return &html_content_handler_;
105 } 105 }
106 106
107 void ConnectAndWait(const std::string& url) { 107 void ConnectAndWait(const std::string& url) {
108 base::RunLoop run_loop; 108 base::RunLoop run_loop;
109 109
110 ServiceProviderPtr service_provider; 110 InterfaceProviderPtr remote_interfaces;
111 InterfaceRequest<ServiceProvider> service_provider_request = 111 InterfaceRequest<InterfaceProvider> remote_request =
112 GetProxy(&service_provider); 112 GetProxy(&remote_interfaces);
113 // This connection error handler will be called when: 113 // This connection error handler will be called when:
114 // - TestContentHandler::StartApplication() has been called (please see 114 // - TestContentHandler::StartApplication() has been called (please see
115 // comments in that method); or 115 // comments in that method); or
116 // - the application manager fails to fetch the requested URL. 116 // - the application manager fails to fetch the requested URL.
117 service_provider.set_connection_error_handler( 117 remote_interfaces.set_connection_error_handler(
118 [&run_loop]() { run_loop.Quit(); }); 118 [&run_loop]() { run_loop.Quit(); });
119 119
120 scoped_ptr<ConnectToApplicationParams> params( 120 scoped_ptr<ConnectToApplicationParams> params(
121 new ConnectToApplicationParams); 121 new ConnectToApplicationParams);
122 params->SetTargetURL(GURL(url)); 122 params->SetTargetURL(GURL(url));
123 params->set_services(std::move(service_provider_request)); 123 params->set_remote_interfaces(std::move(remote_request));
124 application_manager_->ConnectToApplication(std::move(params)); 124 application_manager_->ConnectToApplication(std::move(params));
125 125
126 run_loop.Run(); 126 run_loop.Run();
127 } 127 }
128 128
129 // Overridden from testing::Test: 129 // Overridden from testing::Test:
130 void SetUp() override { 130 void SetUp() override {
131 base::FilePath shell_dir; 131 base::FilePath shell_dir;
132 PathService::Get(base::DIR_MODULE, &shell_dir); 132 PathService::Get(base::DIR_MODULE, &shell_dir);
133 scoped_ptr<PackageManagerImpl> package_manager( 133 scoped_ptr<PackageManagerImpl> package_manager(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « mojo/shell/connect_util.cc ('k') | mojo/shell/package_manager/content_handler_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698