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 <string.h> | 7 #include <string.h> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 std::vector<unsigned char> png_data; | 118 std::vector<unsigned char> png_data; |
119 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); | 119 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); |
120 scoped_refptr<base::RefCountedBytes> png_bytes = | 120 scoped_refptr<base::RefCountedBytes> png_bytes = |
121 base::RefCountedBytes::TakeVector(&png_data); | 121 base::RefCountedBytes::TakeVector(&png_data); |
122 NavigationEntryImpl* entry_impl = | 122 NavigationEntryImpl* entry_impl = |
123 NavigationEntryImpl::FromNavigationEntry(entry); | 123 NavigationEntryImpl::FromNavigationEntry(entry); |
124 entry_impl->SetScreenshotPNGData(png_bytes); | 124 entry_impl->SetScreenshotPNGData(png_bytes); |
125 } | 125 } |
126 | 126 |
127 void ReceivePaintUpdate() { | 127 void ReceivePaintUpdate() { |
128 ViewHostMsg_DidFirstVisuallyNonEmptyPaint msg( | 128 ViewHostMsg_DidFirstVisuallyNonEmptyPaint msg(test_rvh()->GetRoutingID()); |
129 main_test_rfh()->GetRoutingID()); | |
130 RenderViewHostTester::TestOnMessageReceived(test_rvh(), msg); | 129 RenderViewHostTester::TestOnMessageReceived(test_rvh(), msg); |
131 } | 130 } |
132 | 131 |
133 void PerformBackNavigationViaSliderCallbacks() { | 132 void PerformBackNavigationViaSliderCallbacks() { |
134 // Sets slide direction to BACK, sets screenshot from NavEntry at | 133 // Sets slide direction to BACK, sets screenshot from NavEntry at |
135 // offset -1 on layer_delegate_. | 134 // offset -1 on layer_delegate_. |
136 std::unique_ptr<aura::Window> window( | 135 std::unique_ptr<aura::Window> window( |
137 GetOverlay()->CreateBackWindow(GetBackSlideWindowBounds())); | 136 GetOverlay()->CreateBackWindow(GetBackSlideWindowBounds())); |
138 bool window_created = !!window; | 137 bool window_created = !!window; |
139 // Performs BACK navigation, sets image from layer_delegate_ on | 138 // Performs BACK navigation, sets image from layer_delegate_ on |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 EXPECT_TRUE(GetOverlay()->window_.get()); | 439 EXPECT_TRUE(GetOverlay()->window_.get()); |
441 | 440 |
442 // Load the page. | 441 // Load the page. |
443 contents()->CommitPendingNavigation(); | 442 contents()->CommitPendingNavigation(); |
444 ReceivePaintUpdate(); | 443 ReceivePaintUpdate(); |
445 EXPECT_FALSE(GetOverlay()->window_.get()); | 444 EXPECT_FALSE(GetOverlay()->window_.get()); |
446 EXPECT_EQ(contents()->GetURL(), first()); | 445 EXPECT_EQ(contents()->GetURL(), first()); |
447 } | 446 } |
448 | 447 |
449 } // namespace content | 448 } // namespace content |
OLD | NEW |