Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: content/browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc

Issue 895543005: Refactor GestureNavigation to eliminate code redundancy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <vector>
7 #include "content/browser/frame_host/navigation_entry_impl.h" 8 #include "content/browser/frame_host/navigation_entry_impl.h"
8 #include "content/browser/web_contents/web_contents_view.h" 9 #include "content/browser/web_contents/web_contents_view.h"
9 #include "content/common/frame_messages.h" 10 #include "content/common/frame_messages.h"
10 #include "content/common/view_messages.h" 11 #include "content/common/view_messages.h"
12 #include "content/public/browser/overscroll_configuration.h"
11 #include "content/public/test/mock_render_process_host.h" 13 #include "content/public/test/mock_render_process_host.h"
12 #include "content/test/test_render_frame_host.h" 14 #include "content/test/test_render_frame_host.h"
13 #include "content/test/test_render_view_host.h" 15 #include "content/test/test_render_view_host.h"
14 #include "content/test/test_web_contents.h" 16 #include "content/test/test_web_contents.h"
15 #include "ui/aura/test/test_windows.h" 17 #include "ui/aura/test/test_windows.h"
16 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
17 #include "ui/aura_extra/image_window_delegate.h" 19 #include "ui/aura_extra/image_window_delegate.h"
20 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
21 #include "ui/compositor/scoped_layer_animation_settings.h"
22 #include "ui/compositor/test/layer_animator_test_controller.h"
23 #include "ui/events/gesture_detection/gesture_configuration.h"
24 #include "ui/events/test/event_generator.h"
18 #include "ui/gfx/codec/png_codec.h" 25 #include "ui/gfx/codec/png_codec.h"
26 #include "ui/gfx/frame_time.h"
19 27
20 namespace content { 28 namespace content {
21 29
30 // A subclass of TestWebContents that offers a fake content window.
31 class OverscrollTestWebContents : public TestWebContents {
32 public:
33 ~OverscrollTestWebContents() override {}
34
35 static OverscrollTestWebContents* Create(
36 BrowserContext* browser_context,
37 SiteInstance* instance,
38 scoped_ptr<aura::Window> fake_native_view,
39 scoped_ptr<aura::Window> fake_contents_window) {
40 OverscrollTestWebContents* web_contents = new OverscrollTestWebContents(
41 browser_context, fake_native_view.Pass(), fake_contents_window.Pass());
42 web_contents->Init(WebContents::CreateParams(browser_context, instance));
43 web_contents->RenderFrameCreated(web_contents->GetMainFrame());
44 return web_contents;
45 }
46
47 gfx::NativeView GetNativeView() override { return fake_native_view_.get(); }
48
49 gfx::NativeView GetContentNativeView() override {
50 return fake_contents_window_.get();
51 }
52
53 protected:
54 explicit OverscrollTestWebContents(
55 BrowserContext* browser_context,
56 scoped_ptr<aura::Window> fake_native_view,
57 scoped_ptr<aura::Window> fake_contents_window)
58 : TestWebContents(browser_context),
59 fake_native_view_(fake_native_view.Pass()),
60 fake_contents_window_(fake_contents_window.Pass()) {}
61
62 private:
63 scoped_ptr<aura::Window> fake_native_view_;
64 scoped_ptr<aura::Window> fake_contents_window_;
65 };
66
22 class OverscrollNavigationOverlayTest : public RenderViewHostImplTestHarness { 67 class OverscrollNavigationOverlayTest : public RenderViewHostImplTestHarness {
23 public: 68 public:
24 OverscrollNavigationOverlayTest() {} 69 OverscrollNavigationOverlayTest()
70 : first_("https://www.google.com"),
71 second_("http://www.chromium.org"),
72 third_("https://www.kernel.org/"),
73 fourth_("https://github.com/") {}
74
25 ~OverscrollNavigationOverlayTest() override {} 75 ~OverscrollNavigationOverlayTest() override {}
26 76
27 gfx::Image CreateDummyScreenshot() {
28 SkBitmap bitmap;
29 bitmap.allocN32Pixels(1, 1);
30 bitmap.eraseColor(SK_ColorWHITE);
31 return gfx::Image::CreateFrom1xBitmap(bitmap);
32 }
33
34 void SetDummyScreenshotOnNavEntry(NavigationEntry* entry) { 77 void SetDummyScreenshotOnNavEntry(NavigationEntry* entry) {
35 SkBitmap bitmap; 78 SkBitmap bitmap;
36 bitmap.allocN32Pixels(1, 1); 79 bitmap.allocN32Pixels(1, 1);
37 bitmap.eraseColor(SK_ColorWHITE); 80 bitmap.eraseColor(SK_ColorWHITE);
38 std::vector<unsigned char> png_data; 81 std::vector<unsigned char> png_data;
39 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); 82 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data);
40 scoped_refptr<base::RefCountedBytes> png_bytes = 83 scoped_refptr<base::RefCountedBytes> png_bytes =
41 base::RefCountedBytes::TakeVector(&png_data); 84 base::RefCountedBytes::TakeVector(&png_data);
42 NavigationEntryImpl* entry_impl = 85 NavigationEntryImpl* entry_impl =
43 NavigationEntryImpl::FromNavigationEntry(entry); 86 NavigationEntryImpl::FromNavigationEntry(entry);
44 entry_impl->SetScreenshotPNGData(png_bytes); 87 entry_impl->SetScreenshotPNGData(png_bytes);
45 } 88 }
46 89
47 void ReceivePaintUpdate() { 90 void ReceivePaintUpdate() {
48 FrameHostMsg_DidFirstVisuallyNonEmptyPaint msg( 91 FrameHostMsg_DidFirstVisuallyNonEmptyPaint msg(
49 main_test_rfh()->GetRoutingID()); 92 main_test_rfh()->GetRoutingID());
50 RenderViewHostTester::TestOnMessageReceived(test_rvh(), msg); 93 RenderViewHostTester::TestOnMessageReceived(test_rvh(), msg);
51 } 94 }
52 95
53 void PerformBackNavigationViaSliderCallbacks() { 96 void PerformBackNavigationViaSliderCallbacks() {
54 // Sets slide direction to SLIDE_BACK, sets screenshot from NavEntry at 97 // Sets slide direction to BACK, sets screenshot from NavEntry at
55 // offset -1 on layer_delegate_. 98 // offset -1 on layer_delegate_.
56 delete GetOverlay()->CreateBackLayer(); 99 scoped_ptr<aura::Window> window(GetOverlay()->CreateBackWindow());
57 // Performs BACK navigation, sets image from layer_delegate_ on 100 // Performs BACK navigation, sets image from layer_delegate_ on
58 // image_delegate_. 101 // image_delegate_.
59 GetOverlay()->OnWindowSlideCompleting(); 102 GetOverlay()->OnOverscrollCompleting();
60 GetOverlay()->OnWindowSlideCompleted(scoped_ptr<ui::Layer>()); 103 if (window) {
104 EXPECT_TRUE(contents()->cross_navigation_pending());
105 EXPECT_EQ(GetOverlay()->direction_, OverscrollNavigationOverlay::BACK);
106 } else {
107 EXPECT_FALSE(contents()->cross_navigation_pending());
108 EXPECT_EQ(GetOverlay()->direction_, OverscrollNavigationOverlay::NONE);
109 }
110 window->SetBounds(gfx::Rect(root_window()->bounds().size()));
111 GetOverlay()->OnOverscrollCompleted(window.Pass());
61 } 112 }
62 113
114 // Tests URLs.
115 const GURL first_;
116 const GURL second_;
117 const GURL third_;
118 const GURL fourth_;
sadrul 2015/04/07 17:10:08 These should be private (with public accessors if
Nina 2015/04/07 19:08:55 Done.
119
63 protected: 120 protected:
64 // RenderViewHostImplTestHarness: 121 // RenderViewHostImplTestHarness:
65 void SetUp() override { 122 void SetUp() override {
66 RenderViewHostImplTestHarness::SetUp(); 123 RenderViewHostImplTestHarness::SetUp();
67 124
68 const GURL first("https://www.google.com"); 125 // Set up the fake web contents native view.
69 contents()->NavigateAndCommit(first); 126 scoped_ptr<aura::Window> fake_native_view(new aura::Window(nullptr));
127 fake_native_view->Init(ui::LAYER_SOLID_COLOR);
128 root_window()->AddChild(fake_native_view.get());
129 fake_native_view->SetBounds(gfx::Rect(root_window()->bounds().size()));
130
131 // Set up the fake contents window.
132 scoped_ptr<aura::Window> fake_contents_window(new aura::Window(nullptr));
133 fake_contents_window->Init(ui::LAYER_SOLID_COLOR);
134 root_window()->AddChild(fake_contents_window.get());
135 fake_contents_window->SetBounds(gfx::Rect(root_window()->bounds().size()));
136
137 // Replace the default test web contents with our custom class.
138 SetContents(OverscrollTestWebContents::Create(
139 browser_context(),
140 SiteInstance::Create(browser_context()),
141 fake_native_view.Pass(),
142 fake_contents_window.Pass()));
143
144 contents()->NavigateAndCommit(first_);
70 EXPECT_TRUE(controller().GetVisibleEntry()); 145 EXPECT_TRUE(controller().GetVisibleEntry());
71 EXPECT_FALSE(controller().CanGoBack()); 146 EXPECT_FALSE(controller().CanGoBack());
72 147
73 const GURL second("http://www.chromium.org"); 148 contents()->NavigateAndCommit(second_);
74 contents()->NavigateAndCommit(second);
75 EXPECT_TRUE(controller().CanGoBack()); 149 EXPECT_TRUE(controller().CanGoBack());
76 150
151 contents()->NavigateAndCommit(third_);
152 EXPECT_TRUE(controller().CanGoBack());
153
154 contents()->NavigateAndCommit(fourth_);
155 EXPECT_TRUE(controller().CanGoBack());
156 EXPECT_FALSE(controller().CanGoForward());
157
77 // Receive a paint update. This is necessary to make sure the size is set 158 // Receive a paint update. This is necessary to make sure the size is set
78 // correctly in RenderWidgetHostImpl. 159 // correctly in RenderWidgetHostImpl.
79 ViewHostMsg_UpdateRect_Params params; 160 ViewHostMsg_UpdateRect_Params params;
80 memset(&params, 0, sizeof(params)); 161 memset(&params, 0, sizeof(params));
81 params.view_size = gfx::Size(10, 10); 162 params.view_size = gfx::Size(10, 10);
82 ViewHostMsg_UpdateRect rect(test_rvh()->GetRoutingID(), params); 163 ViewHostMsg_UpdateRect rect(test_rvh()->GetRoutingID(), params);
83 RenderViewHostTester::TestOnMessageReceived(test_rvh(), rect); 164 RenderViewHostTester::TestOnMessageReceived(test_rvh(), rect);
84 165
85 // Reset pending flags for size/paint. 166 // Reset pending flags for size/paint.
86 test_rvh()->ResetSizeAndRepaintPendingFlags(); 167 test_rvh()->ResetSizeAndRepaintPendingFlags();
87 168
88 // Create the overlay, and set the contents of the overlay window. 169 // Create the overlay, and set the contents of the overlay window.
89 overlay_.reset(new OverscrollNavigationOverlay(contents())); 170 overlay_.reset(new OverscrollNavigationOverlay(contents(), root_window()));
90 aura_extra::ImageWindowDelegate* image_delegate =
91 new aura_extra::ImageWindowDelegate();
92 scoped_ptr<aura::Window> overlay_window(
93 aura::test::CreateTestWindowWithDelegate(
94 image_delegate,
95 0,
96 gfx::Rect(root_window()->bounds().size()),
97 root_window()));
98
99 overlay_->SetOverlayWindow(overlay_window.Pass(), image_delegate);
100 overlay_->StartObserving();
101
102 EXPECT_TRUE(overlay_->web_contents());
103 EXPECT_FALSE(overlay_->loading_complete_);
104 EXPECT_FALSE(overlay_->received_paint_update_);
105 } 171 }
106 172
107 void TearDown() override { 173 void TearDown() override {
108 overlay_.reset(); 174 overlay_.reset();
109 RenderViewHostImplTestHarness::TearDown(); 175 RenderViewHostImplTestHarness::TearDown();
110 } 176 }
111 177
112 OverscrollNavigationOverlay* GetOverlay() { 178 OverscrollNavigationOverlay* GetOverlay() {
113 return overlay_.get(); 179 return overlay_.get();
114 } 180 }
115 181
116 private: 182 private:
117 scoped_ptr<OverscrollNavigationOverlay> overlay_; 183 scoped_ptr<OverscrollNavigationOverlay> overlay_;
118 184
119 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlayTest); 185 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlayTest);
120 }; 186 };
121 187
122 TEST_F(OverscrollNavigationOverlayTest, FirstVisuallyNonEmptyPaint_NoImage) { 188 // Tests that if a screenshot is available, it is set in the overlay window
123 ReceivePaintUpdate(); 189 // delegate.
124 EXPECT_TRUE(GetOverlay()->received_paint_update_); 190 TEST_F(OverscrollNavigationOverlayTest, WithScreenshot) {
125 EXPECT_FALSE(GetOverlay()->loading_complete_); 191 SetDummyScreenshotOnNavEntry(controller().GetEntryAtOffset(-1));
126 // The paint update will hide the overlay. 192 PerformBackNavigationViaSliderCallbacks();
127 EXPECT_FALSE(GetOverlay()->web_contents()); 193 // Screenshot was set on NavEntry at offset -1.
194 EXPECT_TRUE(static_cast<aura_extra::ImageWindowDelegate*>(
195 GetOverlay()->window_->delegate())->has_image());
128 } 196 }
129 197
130 TEST_F(OverscrollNavigationOverlayTest, FirstVisuallyNonEmptyPaint_WithImage) { 198 // Tests that if a screenshot is not available, no image is set in the overlay
131 GetOverlay()->image_delegate_->SetImage(CreateDummyScreenshot()); 199 // window delegate.
132 200 TEST_F(OverscrollNavigationOverlayTest, WithoutScreenshot) {
133 ReceivePaintUpdate(); 201 PerformBackNavigationViaSliderCallbacks();
134 EXPECT_TRUE(GetOverlay()->received_paint_update_); 202 // No screenshot was set on NavEntry at offset -1.
135 EXPECT_FALSE(GetOverlay()->loading_complete_); 203 EXPECT_FALSE(static_cast<aura_extra::ImageWindowDelegate*>(
136 // The paint update will hide the overlay. 204 GetOverlay()->window_->delegate())->has_image());
137 EXPECT_FALSE(GetOverlay()->web_contents());
138 } 205 }
139 206
140 TEST_F(OverscrollNavigationOverlayTest, LoadUpdateWithoutNonEmptyPaint) { 207 // Tests that if a navigation is attempted but there is nothing to navigate to,
141 GetOverlay()->image_delegate_->SetImage(CreateDummyScreenshot()); 208 // we return a null window.
142 process()->sink().ClearMessages(); 209 TEST_F(OverscrollNavigationOverlayTest, CannotNavigate) {
143 210 EXPECT_EQ(GetOverlay()->CreateFrontWindow(), nullptr);
144 contents()->TestSetIsLoading(false);
145 EXPECT_TRUE(GetOverlay()->loading_complete_);
146 EXPECT_FALSE(GetOverlay()->received_paint_update_);
147 // The page load should hide the overlay.
148 EXPECT_FALSE(GetOverlay()->web_contents());
149 } 211 }
150 212
151 TEST_F(OverscrollNavigationOverlayTest, MultiNavigation_PaintUpdate) { 213 // Tests that if a navigation is cancelled, no navigation is performed and the
152 GetOverlay()->image_delegate_->SetImage(CreateDummyScreenshot()); 214 // state is restored.
153 SetDummyScreenshotOnNavEntry(controller().GetEntryAtOffset(-1)); 215 TEST_F(OverscrollNavigationOverlayTest, CancelNavigation) {
216 scoped_ptr<aura::Window> window = GetOverlay()->CreateBackWindow();
217 EXPECT_EQ(GetOverlay()->direction_, OverscrollNavigationOverlay::BACK);
154 218
219 GetOverlay()->OnOverscrollCancelled();
220 EXPECT_FALSE(contents()->cross_navigation_pending());
221 EXPECT_EQ(GetOverlay()->direction_, OverscrollNavigationOverlay::NONE);
222 }
223
224 // Performs two navigations. The second navigation is cancelled, tests that the
225 // first one worked correctly.
226 TEST_F(OverscrollNavigationOverlayTest, CancelAfterSuccessfulNavigation) {
155 PerformBackNavigationViaSliderCallbacks(); 227 PerformBackNavigationViaSliderCallbacks();
156 // Screenshot was set on NavEntry at offset -1. 228 scoped_ptr<aura::Window> wrapper = GetOverlay()->CreateBackWindow();
157 EXPECT_TRUE(GetOverlay()->image_delegate_->has_image()); 229 EXPECT_EQ(GetOverlay()->direction_, OverscrollNavigationOverlay::BACK);
158 EXPECT_FALSE(GetOverlay()->received_paint_update_);
159 230
231 GetOverlay()->OnOverscrollCancelled();
232 EXPECT_EQ(GetOverlay()->direction_, OverscrollNavigationOverlay::NONE);
233
234 EXPECT_TRUE(contents()->cross_navigation_pending());
235 contents()->CommitPendingNavigation();
236 EXPECT_EQ(contents()->GetURL(), third_);
237 }
238
239 // Tests that an overscroll navigation that receives a paint update actually
240 // stops observing.
241 TEST_F(OverscrollNavigationOverlayTest, Navigation_PaintUpdate) {
242 PerformBackNavigationViaSliderCallbacks();
160 ReceivePaintUpdate(); 243 ReceivePaintUpdate();
244
161 // Paint updates until the navigation is committed typically represent updates 245 // Paint updates until the navigation is committed typically represent updates
162 // for the previous page, so they shouldn't affect the flag. 246 // for the previous page, so we should still be observing.
163 EXPECT_FALSE(GetOverlay()->received_paint_update_); 247 EXPECT_TRUE(GetOverlay()->web_contents());
164 248
165 contents()->CommitPendingNavigation(); 249 contents()->CommitPendingNavigation();
166 ReceivePaintUpdate(); 250 ReceivePaintUpdate();
167 // Navigation was committed and the paint update was received - the flag
168 // should now be updated.
169 EXPECT_TRUE(GetOverlay()->received_paint_update_);
170 251
252 // Navigation was committed and the paint update was received - we should no
253 // longer be observing.
171 EXPECT_FALSE(GetOverlay()->web_contents()); 254 EXPECT_FALSE(GetOverlay()->web_contents());
255 EXPECT_EQ(contents()->GetURL(), third_);
172 } 256 }
173 257
174 TEST_F(OverscrollNavigationOverlayTest, MultiNavigation_LoadingUpdate) { 258 // Tests that an overscroll navigation that receives a loading update actually
175 GetOverlay()->image_delegate_->SetImage(CreateDummyScreenshot()); 259 // stops observing.
176 260 TEST_F(OverscrollNavigationOverlayTest, Navigation_LoadingUpdate) {
177 PerformBackNavigationViaSliderCallbacks(); 261 PerformBackNavigationViaSliderCallbacks();
178 // No screenshot was set on NavEntry at offset -1. 262 EXPECT_TRUE(GetOverlay()->web_contents());
179 EXPECT_FALSE(GetOverlay()->image_delegate_->has_image());
180 // Navigation was started, so the loading status flag should be reset.
181 EXPECT_FALSE(GetOverlay()->loading_complete_);
182
183 // DidStopLoading for any navigation should always reset the load flag and 263 // DidStopLoading for any navigation should always reset the load flag and
184 // dismiss the overlay even if the pending navigation wasn't committed - 264 // dismiss the overlay even if the pending navigation wasn't committed -
185 // this is a "safety net" in case we mis-identify the destination webpage 265 // this is a "safety net" in case we mis-identify the destination webpage
186 // (which can happen if a new navigation is performed while while a GestureNav 266 // (which can happen if a new navigation is performed while while a GestureNav
187 // navigation is in progress). 267 // navigation is in progress).
188 contents()->TestSetIsLoading(true); 268 contents()->TestSetIsLoading(true);
189 contents()->TestSetIsLoading(false); 269 contents()->TestSetIsLoading(false);
190 EXPECT_TRUE(GetOverlay()->loading_complete_); 270 EXPECT_FALSE(GetOverlay()->web_contents());
271 contents()->CommitPendingNavigation();
272 EXPECT_EQ(contents()->GetURL(), third_);
273 }
191 274
192 EXPECT_FALSE(GetOverlay()->web_contents()); 275 // Tests that swapping the overlay window at the end of a gesture caused by the
276 // start of a new overscroll does not crash and the events still reach the new
277 // overlay window.
278 TEST_F(OverscrollNavigationOverlayTest, OverlayWindowSwap) {
279 PerformBackNavigationViaSliderCallbacks();
280 aura::Window* first_overlay_window = GetOverlay()->window_.get();
281 EXPECT_TRUE(GetOverlay()->web_contents());
282 EXPECT_TRUE(first_overlay_window);
283
284 // At this stage, the overlay window is covering the web contents. Configure
285 // the animator of the overlay window for the test.
286 ui::ScopedAnimationDurationScaleMode normal_duration(
287 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
288 ui::LayerAnimator* animator = GetOverlay()->window_->layer()->GetAnimator();
289 animator->set_disable_timer_for_test(true);
290 ui::LayerAnimatorTestController test_controller(animator);
291
292 int overscroll_complete_distance =
293 root_window()->bounds().size().width() *
294 content::GetOverscrollConfig(
295 content::OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE) +
296 ui::GestureConfiguration::GetInstance()
297 ->max_touch_move_in_pixels_for_click() + 1;
298
299 // Start and complete a back navigation via a gesture.
300 ui::test::EventGenerator generator(root_window());
301 generator.GestureScrollSequence(gfx::Point(0, 0),
302 gfx::Point(overscroll_complete_distance, 0),
303 base::TimeDelta::FromMilliseconds(10),
304 10);
305
306 ui::ScopedLayerAnimationSettings settings(animator);
307 test_controller.StartThreadedAnimationsIfNeeded();
308
309 // The overlay window should now be being animated to the edge of the screen.
310 // |first_overlay_window| is the back window.
311 // This is what the screen should look like. The X indicates where the next
312 // gesture starts for the test.
313 // +---------root_window--------+
314 // |+-back window--+--front window--+
315 // || | | |
316 // || 1 |X 2 | |
317 // || | | |
318 // |+--------------+------------|---+
319 // +----------------------------+
320 // | overscroll ||
321 // | complete ||
322 // | distance ||
323 // |<------------->||
324 // | second |
325 // | overscroll |
326 // | start distance |
327 // |<-------------->|
328 EXPECT_EQ(GetOverlay()->window_.get(), first_overlay_window);
329
330 // The overlay window is halfway through, start another animation that will
331 // cancel the first one. The event that cancels the animation will go to
332 // the slide window, which will be used as the overlay window when the new
333 // overscroll starts.
334 int second_overscroll_start_distance = overscroll_complete_distance + 1;
335 generator.GestureScrollSequence(
336 gfx::Point(second_overscroll_start_distance, 0),
337 gfx::Point(
338 second_overscroll_start_distance + overscroll_complete_distance, 0),
339 base::TimeDelta::FromMilliseconds(10), 10);
340 EXPECT_TRUE(GetOverlay()->window_.get());
341 // The overlay window should be a new window.
342 EXPECT_NE(GetOverlay()->window_.get(), first_overlay_window);
343
344 // Complete the animation.
345 GetOverlay()->window_->layer()->GetAnimator()->StopAnimating();
346 EXPECT_TRUE(GetOverlay()->window_.get());
347
348 // Load the page.
349 contents()->CommitPendingNavigation();
350 ReceivePaintUpdate();
351 EXPECT_FALSE(GetOverlay()->window_.get());
352 EXPECT_EQ(contents()->GetURL(), first_);
193 } 353 }
194 354
195 } // namespace content 355 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698