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

Side by Side Diff: content/test/test_navigation_url_loader.h

Issue 1721813002: Adding DRP specfic UMA for FirstContentfulPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years, 7 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 | « content/public/test/web_contents_tester.h ('k') | content/test/test_navigation_url_loader.cc » ('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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 #ifndef CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ 5 #ifndef CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_
6 #define CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ 6 #define CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "content/browser/frame_host/navigation_request_info.h" 11 #include "content/browser/frame_host/navigation_request_info.h"
12 #include "content/browser/loader/navigation_url_loader.h" 12 #include "content/browser/loader/navigation_url_loader.h"
13 #include "content/common/navigation_params.h" 13 #include "content/common/navigation_params.h"
14 14
15 namespace net { 15 namespace net {
16 struct RedirectInfo; 16 struct RedirectInfo;
17 } 17 }
18 18
19 namespace content { 19 namespace content {
20 20
21 class NavigationData;
21 class NavigationURLLoaderDelegate; 22 class NavigationURLLoaderDelegate;
22 class StreamHandle; 23 class StreamHandle;
23 struct ResourceResponse; 24 struct ResourceResponse;
24 25
25 // PlzNavigate 26 // PlzNavigate
26 // Test implementation of NavigationURLLoader to simulate the network stack 27 // Test implementation of NavigationURLLoader to simulate the network stack
27 // response. 28 // response.
28 class TestNavigationURLLoader 29 class TestNavigationURLLoader
29 : public NavigationURLLoader, 30 : public NavigationURLLoader,
30 public base::SupportsWeakPtr<TestNavigationURLLoader> { 31 public base::SupportsWeakPtr<TestNavigationURLLoader> {
31 public: 32 public:
32 TestNavigationURLLoader(std::unique_ptr<NavigationRequestInfo> request_info, 33 TestNavigationURLLoader(std::unique_ptr<NavigationRequestInfo> request_info,
33 NavigationURLLoaderDelegate* delegate); 34 NavigationURLLoaderDelegate* delegate);
34 35
35 // NavigationURLLoader implementation. 36 // NavigationURLLoader implementation.
36 void FollowRedirect() override; 37 void FollowRedirect() override;
37 void ProceedWithResponse() override; 38 void ProceedWithResponse() override;
38 39
39 NavigationRequestInfo* request_info() const { return request_info_.get(); } 40 NavigationRequestInfo* request_info() const { return request_info_.get(); }
40 41
41 void SimulateServerRedirect(const GURL& redirect_url); 42 void SimulateServerRedirect(const GURL& redirect_url);
42 43
43 void SimulateError(int error_code); 44 void SimulateError(int error_code);
44 45
45 void CallOnRequestRedirected(const net::RedirectInfo& redirect_info, 46 void CallOnRequestRedirected(const net::RedirectInfo& redirect_info,
46 const scoped_refptr<ResourceResponse>& response); 47 const scoped_refptr<ResourceResponse>& response);
47 void CallOnResponseStarted(const scoped_refptr<ResourceResponse>& response, 48 void CallOnResponseStarted(const scoped_refptr<ResourceResponse>& response,
48 std::unique_ptr<StreamHandle> body); 49 std::unique_ptr<StreamHandle> body,
50 std::unique_ptr<NavigationData> navigation_data);
49 51
50 int redirect_count() { return redirect_count_; } 52 int redirect_count() { return redirect_count_; }
51 53
52 bool response_proceeded() { return response_proceeded_; } 54 bool response_proceeded() { return response_proceeded_; }
53 55
54 private: 56 private:
55 ~TestNavigationURLLoader() override; 57 ~TestNavigationURLLoader() override;
56 58
57 std::unique_ptr<NavigationRequestInfo> request_info_; 59 std::unique_ptr<NavigationRequestInfo> request_info_;
58 NavigationURLLoaderDelegate* delegate_; 60 NavigationURLLoaderDelegate* delegate_;
59 int redirect_count_; 61 int redirect_count_;
60 bool response_proceeded_; 62 bool response_proceeded_;
61 }; 63 };
62 64
63 } // namespace content 65 } // namespace content
64 66
65 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ 67 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_
OLDNEW
« no previous file with comments | « content/public/test/web_contents_tester.h ('k') | content/test/test_navigation_url_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698