| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |