Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "content/public/common/browser_side_navigation_policy.h" | 6 #include "content/public/common/browser_side_navigation_policy.h" |
| 7 #include "content/public/test/browser_test.h" | 7 #include "content/public/test/browser_test.h" |
| 8 #include "headless/public/devtools/domains/network.h" | 8 #include "headless/public/devtools/domains/network.h" |
| 9 #include "headless/public/devtools/domains/page.h" | 9 #include "headless/public/devtools/domains/page.h" |
| 10 #include "headless/public/headless_devtools_client.h" | 10 #include "headless/public/headless_devtools_client.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 public: | 62 public: |
| 63 explicit MockURLFetcher( | 63 explicit MockURLFetcher( |
| 64 const RequestIdCorrelationProtocolHandler* protocol_handler) | 64 const RequestIdCorrelationProtocolHandler* protocol_handler) |
| 65 : protocol_handler_(protocol_handler) {} | 65 : protocol_handler_(protocol_handler) {} |
| 66 ~MockURLFetcher() override {} | 66 ~MockURLFetcher() override {} |
| 67 | 67 |
| 68 // URLFetcher implementation: | 68 // URLFetcher implementation: |
| 69 void StartFetch(const GURL& url, | 69 void StartFetch(const GURL& url, |
| 70 const std::string& method, | 70 const std::string& method, |
| 71 const net::HttpRequestHeaders& request_headers, | 71 const net::HttpRequestHeaders& request_headers, |
| 72 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.
| |
| 72 ResultListener* result_listener) override { | 73 ResultListener* result_listener) override { |
| 73 const Response* response = protocol_handler_->GetResponse(url.spec()); | 74 const Response* response = protocol_handler_->GetResponse(url.spec()); |
| 74 if (!response) | 75 if (!response) |
| 75 result_listener->OnFetchStartError(net::ERR_FILE_NOT_FOUND); | 76 result_listener->OnFetchStartError(net::ERR_FILE_NOT_FOUND); |
| 76 | 77 |
| 77 // The header used for correlation should not be sent to the fetcher. | 78 // The header used for correlation should not be sent to the fetcher. |
| 78 EXPECT_FALSE(request_headers.HasHeader(kDevtoolsRequestId)); | 79 EXPECT_FALSE(request_headers.HasHeader(kDevtoolsRequestId)); |
| 79 | 80 |
| 80 result_listener->OnFetchCompleteExtractHeaders( | 81 result_listener->OnFetchCompleteExtractHeaders( |
| 81 url, 200, response->data.c_str(), response->data.size()); | 82 url, 200, response->data.c_str(), response->data.size()); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 } | 225 } |
| 225 | 226 |
| 226 private: | 227 private: |
| 227 std::map<std::string, std::string> url_to_devtools_id_; | 228 std::map<std::string, std::string> url_to_devtools_id_; |
| 228 RequestIdCorrelationProtocolHandler* http_handler_; // NOT OWNED | 229 RequestIdCorrelationProtocolHandler* http_handler_; // NOT OWNED |
| 229 }; | 230 }; |
| 230 | 231 |
| 231 HEADLESS_ASYNC_DEVTOOLED_TEST_F(ProtocolHandlerRequestIdCorrelationTest); | 232 HEADLESS_ASYNC_DEVTOOLED_TEST_F(ProtocolHandlerRequestIdCorrelationTest); |
| 232 | 233 |
| 233 } // namespace headless | 234 } // namespace headless |
| OLD | NEW |