OLD | NEW |
---|---|
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 #include "content/public/test/test_navigation_observer.h" | 5 #include "content/public/test/test_navigation_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 parent_(parent) { | 23 parent_(parent) { |
24 } | 24 } |
25 | 25 |
26 private: | 26 private: |
27 // WebContentsObserver: | 27 // WebContentsObserver: |
28 virtual void NavigationEntryCommitted( | 28 virtual void NavigationEntryCommitted( |
29 const LoadCommittedDetails& load_details) OVERRIDE { | 29 const LoadCommittedDetails& load_details) OVERRIDE { |
30 parent_->OnNavigationEntryCommitted(this, web_contents(), load_details); | 30 parent_->OnNavigationEntryCommitted(this, web_contents(), load_details); |
31 } | 31 } |
32 | 32 |
33 virtual void DidAttachInterstitialPage() OVERRIDE { | |
34 parent_->OnDidAttachInterstitialPage(web_contents()); | |
35 } | |
36 | |
33 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { | 37 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { |
34 parent_->OnWebContentsDestroyed(this, web_contents); | 38 parent_->OnWebContentsDestroyed(this, web_contents); |
35 } | 39 } |
36 | 40 |
37 virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE { | 41 virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE { |
38 parent_->OnDidStartLoading(web_contents()); | 42 parent_->OnDidStartLoading(web_contents()); |
39 } | 43 } |
40 | 44 |
41 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE { | 45 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE { |
42 parent_->OnDidStopLoading(web_contents()); | 46 parent_->OnDidStopLoading(web_contents()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 delete observer; | 115 delete observer; |
112 } | 116 } |
113 | 117 |
114 void TestNavigationObserver::OnNavigationEntryCommitted( | 118 void TestNavigationObserver::OnNavigationEntryCommitted( |
115 TestWebContentsObserver* observer, | 119 TestWebContentsObserver* observer, |
116 WebContents* web_contents, | 120 WebContents* web_contents, |
117 const LoadCommittedDetails& load_details) { | 121 const LoadCommittedDetails& load_details) { |
118 navigation_started_ = true; | 122 navigation_started_ = true; |
119 } | 123 } |
120 | 124 |
125 void TestNavigationObserver::OnDidAttachInterstitialPage( | |
126 WebContents* web_contents) { | |
127 // Going to an interstitial page does not trigger NavigationEntryCommited, but | |
Bernhard Bauer
2014/04/25 08:30:13
"NavigationEntryCommitted"
Marc Treib
2014/04/25 08:50:34
Done.
Bernhard Bauer
2014/04/29 07:57:37
No, I meant that "committed" is spelled with doubl
Marc Treib
2014/04/29 08:14:31
Might have made that more obvious :P
Anyway, juust
| |
128 // has the same meaning for us here. | |
129 navigation_started_ = true; | |
Marc Treib
2014/04/25 08:12:38
The situation where this is required is as follows
| |
130 } | |
131 | |
121 void TestNavigationObserver::OnDidStartLoading(WebContents* web_contents) { | 132 void TestNavigationObserver::OnDidStartLoading(WebContents* web_contents) { |
122 navigation_started_ = true; | 133 navigation_started_ = true; |
123 } | 134 } |
124 | 135 |
125 void TestNavigationObserver::OnDidStopLoading(WebContents* web_contents) { | 136 void TestNavigationObserver::OnDidStopLoading(WebContents* web_contents) { |
126 if (!navigation_started_) | 137 if (!navigation_started_) |
127 return; | 138 return; |
128 | 139 |
129 ++navigations_completed_; | 140 ++navigations_completed_; |
130 if (navigations_completed_ == number_of_navigations_) { | 141 if (navigations_completed_ == number_of_navigations_) { |
131 navigation_started_ = false; | 142 navigation_started_ = false; |
132 message_loop_runner_->Quit(); | 143 message_loop_runner_->Quit(); |
133 } | 144 } |
134 } | 145 } |
135 | 146 |
136 } // namespace content | 147 } // namespace content |
OLD | NEW |