Chromium Code Reviews| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 : fetch_reply_(base::JSONReader::Read(json_reply, base::JSON_PARSE_RFC)), | 48 : fetch_reply_(base::JSONReader::Read(json_reply, base::JSON_PARSE_RFC)), |
| 49 fetch_request_(fetch_request) { | 49 fetch_request_(fetch_request) { |
| 50 CHECK(fetch_reply_) << "Invalid json: " << json_reply; | 50 CHECK(fetch_reply_) << "Invalid json: " << json_reply; |
| 51 } | 51 } |
| 52 | 52 |
| 53 ~MockFetcher() override {} | 53 ~MockFetcher() override {} |
| 54 | 54 |
| 55 void StartFetch(const GURL& url, | 55 void StartFetch(const GURL& url, |
| 56 const std::string& method, | 56 const std::string& method, |
| 57 const net::HttpRequestHeaders& request_headers, | 57 const net::HttpRequestHeaders& request_headers, |
| 58 const std::string& devtools_request_id_, | |
|
Sami
2017/03/13 12:08:24
nit: no trailing underscore
alex clarke (OOO till 29th)
2017/03/13 13:38:22
Done.
| |
| 58 ResultListener* result_listener) override { | 59 ResultListener* result_listener) override { |
| 59 // Record the request. | 60 // Record the request. |
| 60 fetch_request_->SetString("url", url.spec()); | 61 fetch_request_->SetString("url", url.spec()); |
| 61 fetch_request_->SetString("method", method); | 62 fetch_request_->SetString("method", method); |
| 62 std::unique_ptr<base::DictionaryValue> headers(new base::DictionaryValue); | 63 std::unique_ptr<base::DictionaryValue> headers(new base::DictionaryValue); |
| 63 for (net::HttpRequestHeaders::Iterator it(request_headers); it.GetNext();) { | 64 for (net::HttpRequestHeaders::Iterator it(request_headers); it.GetNext();) { |
| 64 headers->SetString(it.name(), it.value()); | 65 headers->SetString(it.name(), it.value()); |
| 65 } | 66 } |
| 66 fetch_request_->Set("headers", std::move(headers)); | 67 fetch_request_->Set("headers", std::move(headers)); |
| 67 | 68 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 job_delegate_.SetShouldBlock(true); | 363 job_delegate_.SetShouldBlock(true); |
| 363 | 364 |
| 364 std::unique_ptr<net::URLRequest> request( | 365 std::unique_ptr<net::URLRequest> request( |
| 365 CreateAndCompleteJob(GURL("https://example.com"), reply)); | 366 CreateAndCompleteJob(GURL("https://example.com"), reply)); |
| 366 | 367 |
| 367 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); | 368 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); |
| 368 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request->status().error()); | 369 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request->status().error()); |
| 369 } | 370 } |
| 370 | 371 |
| 371 } // namespace headless | 372 } // namespace headless |
| OLD | NEW |