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

Side by Side Diff: headless/public/util/generic_url_request_job_test.cc

Issue 2311373002: Remove calls to deprecated MessageLoop methods in headless. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "headless/public/util/generic_url_request_job.h" 5 #include "headless/public/util/generic_url_request_job.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 std::unique_ptr<net::URLRequest> CreateAndCompleteJob( 141 std::unique_ptr<net::URLRequest> CreateAndCompleteJob(
142 const GURL& url, 142 const GURL& url,
143 const std::string& json_reply) { 143 const std::string& json_reply) {
144 json_fetch_reply_ = json_reply; 144 json_fetch_reply_ = json_reply;
145 145
146 std::unique_ptr<net::URLRequest> request(url_request_context_.CreateRequest( 146 std::unique_ptr<net::URLRequest> request(url_request_context_.CreateRequest(
147 url, net::DEFAULT_PRIORITY, &request_delegate_)); 147 url, net::DEFAULT_PRIORITY, &request_delegate_));
148 request->Start(); 148 request->Start();
149 message_loop_.RunUntilIdle(); 149 base::RunLoop().RunUntilIdle();
150 return request; 150 return request;
151 } 151 }
152 152
153 protected: 153 protected:
154 base::MessageLoop message_loop_; 154 base::MessageLoop message_loop_;
155 ExpeditedDispatcher dispatcher_; 155 ExpeditedDispatcher dispatcher_;
156 156
157 net::URLRequestJobFactoryImpl url_request_job_factory_; 157 net::URLRequestJobFactoryImpl url_request_job_factory_;
158 net::URLRequestContext url_request_context_; 158 net::URLRequestContext url_request_context_;
159 MockCookieStore cookie_store_; 159 MockCookieStore cookie_store_;
(...skipping 12 matching lines...) Expand all
172 " \"data\":\"Reply\"," 172 " \"data\":\"Reply\","
173 " \"headers\":{\"Content-Type\":\"text/plain\"}}"; 173 " \"headers\":{\"Content-Type\":\"text/plain\"}}";
174 174
175 std::unique_ptr<net::URLRequest> request(url_request_context_.CreateRequest( 175 std::unique_ptr<net::URLRequest> request(url_request_context_.CreateRequest(
176 GURL("https://example.com"), net::DEFAULT_PRIORITY, &request_delegate_)); 176 GURL("https://example.com"), net::DEFAULT_PRIORITY, &request_delegate_));
177 request->SetReferrer("https://referrer.example.com"); 177 request->SetReferrer("https://referrer.example.com");
178 request->SetExtraRequestHeaderByName("Extra-Header", "Value", true); 178 request->SetExtraRequestHeaderByName("Extra-Header", "Value", true);
179 request->SetExtraRequestHeaderByName("User-Agent", "TestBrowser", true); 179 request->SetExtraRequestHeaderByName("User-Agent", "TestBrowser", true);
180 request->SetExtraRequestHeaderByName("Accept", "text/plain", true); 180 request->SetExtraRequestHeaderByName("Accept", "text/plain", true);
181 request->Start(); 181 request->Start();
182 message_loop_.RunUntilIdle(); 182 base::RunLoop().RunUntilIdle();
183 183
184 std::string expected_request_json = 184 std::string expected_request_json =
185 "{\"url\": \"https://example.com/\"," 185 "{\"url\": \"https://example.com/\","
186 " \"headers\": {" 186 " \"headers\": {"
187 " \"Accept\": \"text/plain\"," 187 " \"Accept\": \"text/plain\","
188 " \"Cookie\": \"\"," 188 " \"Cookie\": \"\","
189 " \"Extra-Header\": \"Value\"," 189 " \"Extra-Header\": \"Value\","
190 " \"Referer\": \"https://referrer.example.com/\"," 190 " \"Referer\": \"https://referrer.example.com/\","
191 " \"User-Agent\": \"TestBrowser\"" 191 " \"User-Agent\": \"TestBrowser\""
192 " }" 192 " }"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 job_delegate_.SetShouldBlock(true); 353 job_delegate_.SetShouldBlock(true);
354 354
355 std::unique_ptr<net::URLRequest> request( 355 std::unique_ptr<net::URLRequest> request(
356 CreateAndCompleteJob(GURL("https://example.com"), reply)); 356 CreateAndCompleteJob(GURL("https://example.com"), reply));
357 357
358 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); 358 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
359 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request->status().error()); 359 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request->status().error());
360 } 360 }
361 361
362 } // namespace headless 362 } // namespace headless
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698