| 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" | 8 #include "content/browser/web_contents/aura/image_window_delegate.h" |
| 9 #include "content/browser/web_contents/web_contents_view.h" | 9 #include "content/browser/web_contents/web_contents_view.h" |
| 10 #include "content/common/frame_messages.h" |
| 10 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
| 11 #include "content/public/test/mock_render_process_host.h" | 12 #include "content/public/test/mock_render_process_host.h" |
| 12 #include "content/test/test_render_view_host.h" | 13 #include "content/test/test_render_view_host.h" |
| 13 #include "content/test/test_web_contents.h" | 14 #include "content/test/test_web_contents.h" |
| 14 #include "ui/aura/test/test_windows.h" | 15 #include "ui/aura/test/test_windows.h" |
| 15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 16 #include "ui/gfx/codec/png_codec.h" | 17 #include "ui/gfx/codec/png_codec.h" |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 | 20 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 38 std::vector<unsigned char> png_data; | 39 std::vector<unsigned char> png_data; |
| 39 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); | 40 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); |
| 40 scoped_refptr<base::RefCountedBytes> png_bytes = | 41 scoped_refptr<base::RefCountedBytes> png_bytes = |
| 41 base::RefCountedBytes::TakeVector(&png_data); | 42 base::RefCountedBytes::TakeVector(&png_data); |
| 42 NavigationEntryImpl* entry_impl = | 43 NavigationEntryImpl* entry_impl = |
| 43 NavigationEntryImpl::FromNavigationEntry(entry); | 44 NavigationEntryImpl::FromNavigationEntry(entry); |
| 44 entry_impl->SetScreenshotPNGData(png_bytes); | 45 entry_impl->SetScreenshotPNGData(png_bytes); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void ReceivePaintUpdate() { | 48 void ReceivePaintUpdate() { |
| 48 ViewHostMsg_DidFirstVisuallyNonEmptyPaint msg(test_rvh()->GetRoutingID()); | 49 FrameHostMsg_DidFirstVisuallyNonEmptyPaint msg( |
| 50 main_test_rfh()->GetRoutingID()); |
| 49 RenderViewHostTester::TestOnMessageReceived(test_rvh(), msg); | 51 RenderViewHostTester::TestOnMessageReceived(test_rvh(), msg); |
| 50 } | 52 } |
| 51 | 53 |
| 52 void PerformBackNavigationViaSliderCallbacks() { | 54 void PerformBackNavigationViaSliderCallbacks() { |
| 53 // Sets slide direction to SLIDE_BACK, sets screenshot from NavEntry at | 55 // Sets slide direction to SLIDE_BACK, sets screenshot from NavEntry at |
| 54 // offset -1 on layer_delegate_. | 56 // offset -1 on layer_delegate_. |
| 55 delete GetOverlay()->CreateBackLayer(); | 57 delete GetOverlay()->CreateBackLayer(); |
| 56 // Performs BACK navigation, sets image from layer_delegate_ on | 58 // Performs BACK navigation, sets image from layer_delegate_ on |
| 57 // image_delegate_. | 59 // image_delegate_. |
| 58 GetOverlay()->OnWindowSlideCompleting(); | 60 GetOverlay()->OnWindowSlideCompleting(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // Navigation was committed and the load update was received - the flag | 212 // Navigation was committed and the load update was received - the flag |
| 211 // should now be updated. | 213 // should now be updated. |
| 212 EXPECT_TRUE(GetOverlay()->loading_complete_); | 214 EXPECT_TRUE(GetOverlay()->loading_complete_); |
| 213 | 215 |
| 214 EXPECT_TRUE(GetOverlay()->web_contents()); | 216 EXPECT_TRUE(GetOverlay()->web_contents()); |
| 215 ReceivePaintUpdate(); | 217 ReceivePaintUpdate(); |
| 216 EXPECT_FALSE(GetOverlay()->web_contents()); | 218 EXPECT_FALSE(GetOverlay()->web_contents()); |
| 217 } | 219 } |
| 218 | 220 |
| 219 } // namespace content | 221 } // namespace content |
| OLD | NEW |