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" |
11 #include "content/browser/web_contents/web_contents_impl.h" | 11 #include "content/browser/web_contents/web_contents_impl.h" |
12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 class TestNavigationObserver::TestWebContentsObserver | 17 class TestNavigationObserver::TestWebContentsObserver |
18 : public WebContentsObserver { | 18 : public WebContentsObserver { |
19 public: | 19 public: |
20 TestWebContentsObserver(TestNavigationObserver* parent, | 20 TestWebContentsObserver(TestNavigationObserver* parent, |
21 WebContents* web_contents) | 21 WebContents* web_contents) |
22 : WebContentsObserver(web_contents), | 22 : WebContentsObserver(web_contents), |
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 { | 33 virtual void DidAttachInterstitialPage() override { |
34 parent_->OnDidAttachInterstitialPage(web_contents()); | 34 parent_->OnDidAttachInterstitialPage(web_contents()); |
35 } | 35 } |
36 | 36 |
37 virtual void WebContentsDestroyed() OVERRIDE { | 37 virtual void WebContentsDestroyed() override { |
38 parent_->OnWebContentsDestroyed(this, web_contents()); | 38 parent_->OnWebContentsDestroyed(this, web_contents()); |
39 } | 39 } |
40 | 40 |
41 virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE { | 41 virtual void DidStartLoading(RenderViewHost* render_view_host) override { |
42 parent_->OnDidStartLoading(web_contents()); | 42 parent_->OnDidStartLoading(web_contents()); |
43 } | 43 } |
44 | 44 |
45 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE { | 45 virtual void DidStopLoading(RenderViewHost* render_view_host) override { |
46 parent_->OnDidStopLoading(web_contents()); | 46 parent_->OnDidStopLoading(web_contents()); |
47 } | 47 } |
48 | 48 |
49 TestNavigationObserver* parent_; | 49 TestNavigationObserver* parent_; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver); | 51 DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver); |
52 }; | 52 }; |
53 | 53 |
54 TestNavigationObserver::TestNavigationObserver( | 54 TestNavigationObserver::TestNavigationObserver( |
55 WebContents* web_contents, | 55 WebContents* web_contents, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 return; | 138 return; |
139 | 139 |
140 ++navigations_completed_; | 140 ++navigations_completed_; |
141 if (navigations_completed_ == number_of_navigations_) { | 141 if (navigations_completed_ == number_of_navigations_) { |
142 navigation_started_ = false; | 142 navigation_started_ = false; |
143 message_loop_runner_->Quit(); | 143 message_loop_runner_->Quit(); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 } // namespace content | 147 } // namespace content |
OLD | NEW |