| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/dom_distiller/content/web_contents_main_frame_observer.h" | 5 #include "components/dom_distiller/content/web_contents_main_frame_observer.h" |
| 6 | 6 |
| 7 #include "content/public/browser/navigation_details.h" | 7 #include "content/public/browser/navigation_details.h" |
| 8 #include "content/public/browser/render_frame_host.h" | 8 #include "content/public/browser/render_frame_host.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| 11 #include "content/public/browser/web_contents_user_data.h" | 11 #include "content/public/browser/web_contents_user_data.h" |
| 12 #include "content/public/test/test_renderer_host.h" | 12 #include "content/public/test/test_renderer_host.h" |
| 13 | 13 |
| 14 namespace dom_distiller { | 14 namespace dom_distiller { |
| 15 | 15 |
| 16 class WebContentsMainFrameObserverTest | 16 class WebContentsMainFrameObserverTest |
| 17 : public content::RenderViewHostTestHarness { | 17 : public content::RenderViewHostTestHarness { |
| 18 virtual void SetUp() override { | 18 void SetUp() override { |
| 19 content::RenderViewHostTestHarness::SetUp(); | 19 content::RenderViewHostTestHarness::SetUp(); |
| 20 dom_distiller::WebContentsMainFrameObserver::CreateForWebContents( | 20 dom_distiller::WebContentsMainFrameObserver::CreateForWebContents( |
| 21 web_contents()); | 21 web_contents()); |
| 22 main_frame_observer_ = | 22 main_frame_observer_ = |
| 23 WebContentsMainFrameObserver::FromWebContents(web_contents()); | 23 WebContentsMainFrameObserver::FromWebContents(web_contents()); |
| 24 ASSERT_FALSE(main_frame_observer_->is_document_loaded_in_main_frame()); | 24 ASSERT_FALSE(main_frame_observer_->is_document_loaded_in_main_frame()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 protected: | 27 protected: |
| 28 WebContentsMainFrameObserver* main_frame_observer_; // weak | 28 WebContentsMainFrameObserver* main_frame_observer_; // weak |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 ASSERT_TRUE(main_frame_observer_->is_document_loaded_in_main_frame()); | 102 ASSERT_TRUE(main_frame_observer_->is_document_loaded_in_main_frame()); |
| 103 | 103 |
| 104 // Navigating withing the page should not result in waiting for a page load. | 104 // Navigating withing the page should not result in waiting for a page load. |
| 105 details.is_in_page = true; | 105 details.is_in_page = true; |
| 106 main_frame_observer_->DidNavigateMainFrame(details, params); | 106 main_frame_observer_->DidNavigateMainFrame(details, params); |
| 107 ASSERT_TRUE(main_frame_observer_->is_initialized()); | 107 ASSERT_TRUE(main_frame_observer_->is_initialized()); |
| 108 ASSERT_TRUE(main_frame_observer_->is_document_loaded_in_main_frame()); | 108 ASSERT_TRUE(main_frame_observer_->is_document_loaded_in_main_frame()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace dom_distiller | 111 } // namespace dom_distiller |
| OLD | NEW |