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

Side by Side Diff: content/public/test/navigation_handle_observer.h

Issue 2889703002: Ensure that all code paths which call FrameTreeNode::ResetNavigationRequest set NavigationHandle::G… (Closed)
Patch Set: review comments Created 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_TEST_NAVIGATION_HANDLE_OBSERVER_H_
6 #define CONTENT_PUBLIC_TEST_NAVIGATION_HANDLE_OBSERVER_H_
7
8 #include "base/macros.h"
9 #include "content/public/browser/web_contents_observer.h"
10
11 namespace content {
12
13 // Gathers data from the NavigationHandle assigned to navigations that start
14 // with the expected URL.
15 class NavigationHandleObserver : public WebContentsObserver {
16 public:
17 NavigationHandleObserver(WebContents* web_contents,
18 const GURL& expected_start_url);
19
20 void DidStartNavigation(NavigationHandle* navigation_handle) override;
21 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
22
23 bool has_committed() { return has_committed_; }
24 bool is_error() { return is_error_; }
25 bool is_main_frame() { return is_main_frame_; }
26 bool is_parent_main_frame() { return is_parent_main_frame_; }
27 bool is_renderer_initiated() { return is_renderer_initiated_; }
28 bool is_same_document() { return is_same_document_; }
29 bool was_redirected() { return was_redirected_; }
30 int frame_tree_node_id() { return frame_tree_node_id_; }
31 const GURL& last_committed_url() { return last_committed_url_; }
32 ui::PageTransition page_transition() { return page_transition_; }
33 net::Error net_error_code() { return net_error_code_; }
34
35 private:
36 // A reference to the NavigationHandle so this class will track only
37 // one navigation at a time. It is set at DidStartNavigation and cleared
38 // at DidFinishNavigation before the NavigationHandle is destroyed.
39 NavigationHandle* handle_ = nullptr;
40 bool has_committed_ = false;
41 bool is_error_ = false;
42 bool is_main_frame_ = false;
43 bool is_parent_main_frame_ = false;
44 bool is_renderer_initiated_ = true;
45 bool is_same_document_ = false;
46 bool was_redirected_ = false;
47 int frame_tree_node_id_ = -1;
48 ui::PageTransition page_transition_ = ui::PAGE_TRANSITION_LINK;
49 GURL expected_start_url_;
50 GURL last_committed_url_;
51 net::Error net_error_code_ = net::OK;
52
53 DISALLOW_COPY_AND_ASSIGN(NavigationHandleObserver);
54 };
55
56 } // namespace content
57
58 #endif // CONTENT_PUBLIC_TEST_NAVIGATION_HANDLE_OBSERVER_H_
OLDNEW
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | content/public/test/navigation_handle_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698