| 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 "content/browser/web_contents/aura/overscroll_navigation_overlay.h" | 5 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" |
| 6 | 6 |
| 7 #include "content/browser/frame_host/navigation_entry_impl.h" | 7 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 8 #include "content/browser/web_contents/aura/image_window_delegate.h" | |
| 9 #include "content/browser/web_contents/web_contents_view.h" | 8 #include "content/browser/web_contents/web_contents_view.h" |
| 10 #include "content/common/frame_messages.h" | 9 #include "content/common/frame_messages.h" |
| 11 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| 12 #include "content/public/test/mock_render_process_host.h" | 11 #include "content/public/test/mock_render_process_host.h" |
| 13 #include "content/test/test_render_frame_host.h" | 12 #include "content/test/test_render_frame_host.h" |
| 14 #include "content/test/test_render_view_host.h" | 13 #include "content/test/test_render_view_host.h" |
| 15 #include "content/test/test_web_contents.h" | 14 #include "content/test/test_web_contents.h" |
| 16 #include "ui/aura/test/test_windows.h" | 15 #include "ui/aura/test/test_windows.h" |
| 17 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/aura_extra/image_window_delegate.h" |
| 18 #include "ui/gfx/codec/png_codec.h" | 18 #include "ui/gfx/codec/png_codec.h" |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class OverscrollNavigationOverlayTest : public RenderViewHostImplTestHarness { | 22 class OverscrollNavigationOverlayTest : public RenderViewHostImplTestHarness { |
| 23 public: | 23 public: |
| 24 OverscrollNavigationOverlayTest() {} | 24 OverscrollNavigationOverlayTest() {} |
| 25 ~OverscrollNavigationOverlayTest() override {} | 25 ~OverscrollNavigationOverlayTest() override {} |
| 26 | 26 |
| 27 gfx::Image CreateDummyScreenshot() { | 27 gfx::Image CreateDummyScreenshot() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 memset(¶ms, 0, sizeof(params)); | 80 memset(¶ms, 0, sizeof(params)); |
| 81 params.view_size = gfx::Size(10, 10); | 81 params.view_size = gfx::Size(10, 10); |
| 82 ViewHostMsg_UpdateRect rect(test_rvh()->GetRoutingID(), params); | 82 ViewHostMsg_UpdateRect rect(test_rvh()->GetRoutingID(), params); |
| 83 RenderViewHostTester::TestOnMessageReceived(test_rvh(), rect); | 83 RenderViewHostTester::TestOnMessageReceived(test_rvh(), rect); |
| 84 | 84 |
| 85 // Reset pending flags for size/paint. | 85 // Reset pending flags for size/paint. |
| 86 test_rvh()->ResetSizeAndRepaintPendingFlags(); | 86 test_rvh()->ResetSizeAndRepaintPendingFlags(); |
| 87 | 87 |
| 88 // Create the overlay, and set the contents of the overlay window. | 88 // Create the overlay, and set the contents of the overlay window. |
| 89 overlay_.reset(new OverscrollNavigationOverlay(contents())); | 89 overlay_.reset(new OverscrollNavigationOverlay(contents())); |
| 90 ImageWindowDelegate* image_delegate = new ImageWindowDelegate(); | 90 aura_extra::ImageWindowDelegate* image_delegate = |
| 91 new aura_extra::ImageWindowDelegate(); |
| 91 scoped_ptr<aura::Window> overlay_window( | 92 scoped_ptr<aura::Window> overlay_window( |
| 92 aura::test::CreateTestWindowWithDelegate( | 93 aura::test::CreateTestWindowWithDelegate( |
| 93 image_delegate, | 94 image_delegate, |
| 94 0, | 95 0, |
| 95 gfx::Rect(root_window()->bounds().size()), | 96 gfx::Rect(root_window()->bounds().size()), |
| 96 root_window())); | 97 root_window())); |
| 97 | 98 |
| 98 overlay_->SetOverlayWindow(overlay_window.Pass(), image_delegate); | 99 overlay_->SetOverlayWindow(overlay_window.Pass(), image_delegate); |
| 99 overlay_->StartObserving(); | 100 overlay_->StartObserving(); |
| 100 | 101 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // (which can happen if a new navigation is performed while while a GestureNav | 186 // (which can happen if a new navigation is performed while while a GestureNav |
| 186 // navigation is in progress). | 187 // navigation is in progress). |
| 187 contents()->TestSetIsLoading(true); | 188 contents()->TestSetIsLoading(true); |
| 188 contents()->TestSetIsLoading(false); | 189 contents()->TestSetIsLoading(false); |
| 189 EXPECT_TRUE(GetOverlay()->loading_complete_); | 190 EXPECT_TRUE(GetOverlay()->loading_complete_); |
| 190 | 191 |
| 191 EXPECT_FALSE(GetOverlay()->web_contents()); | 192 EXPECT_FALSE(GetOverlay()->web_contents()); |
| 192 } | 193 } |
| 193 | 194 |
| 194 } // namespace content | 195 } // namespace content |
| OLD | NEW |