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

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

Issue 2650033008: Convert TestNavigationObserver to use the new navigation callbacks. (Closed)
Patch Set: fix test Created 3 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ 5 #ifndef CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_
6 #define CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ 6 #define CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 12 #include "base/macros.h"
14 #include "content/public/test/test_utils.h" 13 #include "content/public/test/test_utils.h"
15 #include "ui/base/page_transition_types.h"
16 #include "url/gurl.h" 14 #include "url/gurl.h"
17 15
18 namespace content { 16 namespace content {
19 class RenderFrameHost;
20 class WebContents; 17 class WebContents;
21 struct LoadCommittedDetails;
22 18
23 // For browser_tests, which run on the UI thread, run a second 19 // For browser_tests, which run on the UI thread, run a second
24 // MessageLoop and quit when the navigation completes loading. 20 // MessageLoop and quit when the navigation completes loading.
25 class TestNavigationObserver { 21 class TestNavigationObserver {
26 public: 22 public:
27 // Create and register a new TestNavigationObserver against the 23 // Create and register a new TestNavigationObserver against the
28 // |web_contents|. 24 // |web_contents|.
29 TestNavigationObserver(WebContents* web_contents, 25 TestNavigationObserver(WebContents* web_contents,
30 int number_of_navigations); 26 int number_of_navigations);
31 // Like above but waits for one navigation. 27 // Like above but waits for one navigation.
(...skipping 24 matching lines...) Expand all
56 void OnWebContentsCreated(WebContents* web_contents); 52 void OnWebContentsCreated(WebContents* web_contents);
57 void OnWebContentsDestroyed(TestWebContentsObserver* observer, 53 void OnWebContentsDestroyed(TestWebContentsObserver* observer,
58 WebContents* web_contents); 54 WebContents* web_contents);
59 void OnNavigationEntryCommitted( 55 void OnNavigationEntryCommitted(
60 TestWebContentsObserver* observer, 56 TestWebContentsObserver* observer,
61 WebContents* web_contents, 57 WebContents* web_contents,
62 const LoadCommittedDetails& load_details); 58 const LoadCommittedDetails& load_details);
63 void OnDidAttachInterstitialPage(WebContents* web_contents); 59 void OnDidAttachInterstitialPage(WebContents* web_contents);
64 void OnDidStartLoading(WebContents* web_contents); 60 void OnDidStartLoading(WebContents* web_contents);
65 void OnDidStopLoading(WebContents* web_contents); 61 void OnDidStopLoading(WebContents* web_contents);
66 void OnDidStartProvisionalLoad(RenderFrameHost* render_frame_host, 62 void OnDidStartNavigation();
67 const GURL& validated_url, 63 void OnDidFinishNavigation(bool is_error_page, const GURL& url);
68 bool is_error_page);
69 void OnDidFailProvisionalLoad(RenderFrameHost* render_frame_host,
70 const GURL& validated_url,
71 int error_code,
72 const base::string16& error_description);
73 void OnDidCommitProvisionalLoadForFrame(RenderFrameHost* render_frame_host,
74 const GURL& url,
75 ui::PageTransition transition_type);
76 64
77 // If true the navigation has started. 65 // If true the navigation has started.
78 bool navigation_started_; 66 bool navigation_started_;
79 67
80 // The number of navigations that have been completed. 68 // The number of navigations that have been completed.
81 int navigations_completed_; 69 int navigations_completed_;
82 70
83 // The number of navigations to wait for. 71 // The number of navigations to wait for.
84 int number_of_navigations_; 72 int number_of_navigations_;
85 73
(...skipping 11 matching lines...) Expand all
97 85
98 // Living TestWebContentsObservers created by this observer. 86 // Living TestWebContentsObservers created by this observer.
99 std::set<std::unique_ptr<TestWebContentsObserver>> web_contents_observers_; 87 std::set<std::unique_ptr<TestWebContentsObserver>> web_contents_observers_;
100 88
101 DISALLOW_COPY_AND_ASSIGN(TestNavigationObserver); 89 DISALLOW_COPY_AND_ASSIGN(TestNavigationObserver);
102 }; 90 };
103 91
104 } // namespace content 92 } // namespace content
105 93
106 #endif // CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ 94 #endif // CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_
OLDNEW
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | content/public/test/test_navigation_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698