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

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

Issue 2248283008: Fix recursion bug in blocking a fetch and add a test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unintentional change Created 4 years, 4 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
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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 "{\"url\": \"https://example.com/\"," 336 "{\"url\": \"https://example.com/\","
337 " \"headers\": {" 337 " \"headers\": {"
338 " \"Cookie\": \"basic_cookie=1; secure_cookie=2; http_only_cookie=3\"," 338 " \"Cookie\": \"basic_cookie=1; secure_cookie=2; http_only_cookie=3\","
339 " \"Referer\": \"\"" 339 " \"Referer\": \"\""
340 " }" 340 " }"
341 "}"; 341 "}";
342 342
343 EXPECT_THAT(fetch_request_, MatchesJson(expected_request_json)); 343 EXPECT_THAT(fetch_request_, MatchesJson(expected_request_json));
344 } 344 }
345 345
346 TEST_F(GenericURLRequestJobTest, DelegateBlocksLoading) {
347 std::string reply =
348 "{\"url\":\"https://example.com\","
349 " \"http_response_code\":200,"
350 " \"data\":\"Reply\","
351 " \"headers\":{\"Content-Type\":\"text/html; charset=UTF-8\"}}";
352
353 job_delegate_.SetShouldBlock(true);
354
355 std::unique_ptr<net::URLRequest> request(
356 CreateAndCompleteJob(GURL("https://example.com"), reply));
357
358 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
359 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request->status().error());
360 }
361
346 } // namespace headless 362 } // namespace headless
OLDNEW
« no previous file with comments | « headless/public/util/generic_url_request_job.cc ('k') | headless/public/util/managed_dispatch_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698