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 16 matching lines...) Expand all Loading... |
36 std::vector<unsigned char> png_data; | 37 std::vector<unsigned char> png_data; |
37 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); | 38 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); |
38 scoped_refptr<base::RefCountedBytes> png_bytes = | 39 scoped_refptr<base::RefCountedBytes> png_bytes = |
39 base::RefCountedBytes::TakeVector(&png_data); | 40 base::RefCountedBytes::TakeVector(&png_data); |
40 NavigationEntryImpl* entry_impl = | 41 NavigationEntryImpl* entry_impl = |
41 NavigationEntryImpl::FromNavigationEntry(entry); | 42 NavigationEntryImpl::FromNavigationEntry(entry); |
42 entry_impl->SetScreenshotPNGData(png_bytes); | 43 entry_impl->SetScreenshotPNGData(png_bytes); |
43 } | 44 } |
44 | 45 |
45 void ReceivePaintUpdate() { | 46 void ReceivePaintUpdate() { |
46 ViewHostMsg_DidFirstVisuallyNonEmptyPaint msg(test_rvh()->GetRoutingID()); | 47 FrameHostMsg_DidFirstVisuallyNonEmptyPaint msg( |
| 48 main_test_rfh()->GetRoutingID()); |
47 RenderViewHostTester::TestOnMessageReceived(test_rvh(), msg); | 49 RenderViewHostTester::TestOnMessageReceived(test_rvh(), msg); |
48 } | 50 } |
49 | 51 |
50 void PerformBackNavigationViaSliderCallbacks() { | 52 void PerformBackNavigationViaSliderCallbacks() { |
51 // Sets slide direction to SLIDE_BACK, sets screenshot from NavEntry at | 53 // Sets slide direction to SLIDE_BACK, sets screenshot from NavEntry at |
52 // offset -1 on layer_delegate_. | 54 // offset -1 on layer_delegate_. |
53 delete GetOverlay()->CreateBackLayer(); | 55 delete GetOverlay()->CreateBackLayer(); |
54 // Performs BACK navigation, sets image from layer_delegate_ on | 56 // Performs BACK navigation, sets image from layer_delegate_ on |
55 // image_delegate_. | 57 // image_delegate_. |
56 GetOverlay()->OnWindowSlideCompleting(); | 58 GetOverlay()->OnWindowSlideCompleting(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 contents()->TestSetIsLoading(true); | 188 contents()->TestSetIsLoading(true); |
187 contents()->TestSetIsLoading(false); | 189 contents()->TestSetIsLoading(false); |
188 // Navigation was committed and the load update was received - the flag | 190 // Navigation was committed and the load update was received - the flag |
189 // should now be updated. | 191 // should now be updated. |
190 EXPECT_TRUE(GetOverlay()->loading_complete_); | 192 EXPECT_TRUE(GetOverlay()->loading_complete_); |
191 | 193 |
192 EXPECT_FALSE(GetOverlay()->web_contents()); | 194 EXPECT_FALSE(GetOverlay()->web_contents()); |
193 } | 195 } |
194 | 196 |
195 } // namespace content | 197 } // namespace content |
OLD | NEW |