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

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: Rebase, Tests, Ready for Review 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
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 class NavigationData;
21 class NavigationURLLoaderDelegate; 21 class NavigationURLLoaderDelegate;
22 class StreamHandle; 22 class StreamHandle;
23 struct ResourceResponse; 23 struct ResourceResponse;
24 24
25 // PlzNavigate 25 // PlzNavigate
26 // Test implementation of NavigationURLLoader to simulate the network stack 26 // Test implementation of NavigationURLLoader to simulate the network stack
27 // response. 27 // response.
28 class TestNavigationURLLoader 28 class TestNavigationURLLoader
29 : public NavigationURLLoader, 29 : public NavigationURLLoader,
30 public base::SupportsWeakPtr<TestNavigationURLLoader> { 30 public base::SupportsWeakPtr<TestNavigationURLLoader> {
31 public: 31 public:
32 TestNavigationURLLoader(std::unique_ptr<NavigationRequestInfo> request_info, 32 TestNavigationURLLoader(std::unique_ptr<NavigationRequestInfo> request_info,
33 NavigationURLLoaderDelegate* delegate); 33 NavigationURLLoaderDelegate* delegate);
34 34
35 // NavigationURLLoader implementation. 35 // NavigationURLLoader implementation.
36 void FollowRedirect() override; 36 void FollowRedirect() override;
37 void ProceedWithResponse() override; 37 void ProceedWithResponse() override;
38 38
39 NavigationRequestInfo* request_info() const { return request_info_.get(); } 39 NavigationRequestInfo* request_info() const { return request_info_.get(); }
40 40
41 void SimulateServerRedirect(const GURL& redirect_url); 41 void SimulateServerRedirect(const GURL& redirect_url);
42 42
43 void SimulateError(int error_code); 43 void SimulateError(int error_code);
44 44
45 void CallOnRequestRedirected(const net::RedirectInfo& redirect_info, 45 void CallOnRequestRedirected(const net::RedirectInfo& redirect_info,
46 const scoped_refptr<ResourceResponse>& response); 46 const scoped_refptr<ResourceResponse>& response);
47 void CallOnResponseStarted(const scoped_refptr<ResourceResponse>& response, 47 void CallOnResponseStarted(const scoped_refptr<ResourceResponse>& response,
48 std::unique_ptr<StreamHandle> body); 48 std::unique_ptr<StreamHandle> body,
49 std::unique_ptr<NavigationData> navigation_data);
49 50
50 int redirect_count() { return redirect_count_; } 51 int redirect_count() { return redirect_count_; }
51 52
52 bool response_proceeded() { return response_proceeded_; } 53 bool response_proceeded() { return response_proceeded_; }
53 54
54 private: 55 private:
55 ~TestNavigationURLLoader() override; 56 ~TestNavigationURLLoader() override;
56 57
57 std::unique_ptr<NavigationRequestInfo> request_info_; 58 std::unique_ptr<NavigationRequestInfo> request_info_;
58 NavigationURLLoaderDelegate* delegate_; 59 NavigationURLLoaderDelegate* delegate_;
59 int redirect_count_; 60 int redirect_count_;
60 bool response_proceeded_; 61 bool response_proceeded_;
61 }; 62 };
62 63
63 } // namespace content 64 } // namespace content
64 65
65 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ 66 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698