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

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

Issue 2750513002: Headless: Pass devtools request id to the URLFetcher (Closed)
Patch Set: Remove underscores Created 3 years, 9 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 | « headless/public/util/http_url_fetcher.cc ('k') | headless/public/util/url_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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,
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
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
OLDNEW
« no previous file with comments | « headless/public/util/http_url_fetcher.cc ('k') | headless/public/util/url_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698