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

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

Issue 730553002: PlzNavigate: Refactor unit test helper functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the test utils class Created 6 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_
6 #define CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "content/browser/frame_host/navigation_request_info.h"
11 #include "content/browser/loader/navigation_url_loader.h"
12 #include "content/common/navigation_params.h"
13
14 namespace net {
15 struct RedirectInfo;
16 }
17
18 namespace content {
19
20 class NavigationURLLoaderDelegate;
21 class StreamHandle;
22 struct ResourceResponse;
23
24 // PlzNavigate
25 // Test implementation of NavigationURLLoader to simulate the network stack
26 // response.
27 class TestNavigationURLLoader
28 : public NavigationURLLoader,
29 public base::SupportsWeakPtr<TestNavigationURLLoader> {
30 public:
31 TestNavigationURLLoader(const CommonNavigationParams& common_params,
32 scoped_ptr<NavigationRequestInfo> request_info,
33 NavigationURLLoaderDelegate* delegate);
34
35 // NavigationURLLoader implementation.
36 void FollowRedirect() override;
37
38 const CommonNavigationParams& common_params() const { return common_params_; }
39 NavigationRequestInfo* request_info() const { return request_info_.get(); }
40
41 void CallOnRequestRedirected(const net::RedirectInfo& redirect_info,
42 const scoped_refptr<ResourceResponse>& response);
43 void CallOnResponseStarted(const scoped_refptr<ResourceResponse>& response,
44 scoped_ptr<StreamHandle> body);
45
46 int redirect_count() { return redirect_count_; }
47
48 private:
49 ~TestNavigationURLLoader();
50
51 CommonNavigationParams common_params_;
52 scoped_ptr<NavigationRequestInfo> request_info_;
53 NavigationURLLoaderDelegate* delegate_;
54 int redirect_count_;
55 };
56
57 } // namespace content
58
59 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_
OLDNEW
« no previous file with comments | « content/test/browser_side_navigation_test_utils.cc ('k') | content/test/test_navigation_url_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698