OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "content/browser/renderer_host/render_view_host_impl.h" | 12 #include "content/browser/renderer_host/render_view_host_impl.h" |
13 #include "content/browser/web_contents/navigation_controller_impl.h" | 13 #include "content/browser/web_contents/navigation_controller_impl.h" |
14 #include "content/browser/web_contents/navigation_entry_impl.h" | 14 #include "content/browser/web_contents/navigation_entry_impl.h" |
15 #include "content/browser/web_contents/web_contents_impl.h" | 15 #include "content/browser/web_contents/web_contents_impl.h" |
16 #include "content/public/browser/web_contents_view.h" | 16 #include "content/public/browser/web_contents_view.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
18 #include "content/public/test/browser_test_utils.h" | 18 #include "content/public/test/browser_test_utils.h" |
19 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
20 #include "content/shell/shell.h" | 20 #include "content/shell/shell.h" |
21 #include "content/test/content_browser_test.h" | 21 #include "content/test/content_browser_test.h" |
22 #include "content/test/content_browser_test_utils.h" | 22 #include "content/test/content_browser_test_utils.h" |
23 #include "ui/aura/root_window.h" | 23 #include "ui/aura/root_window.h" |
24 #include "ui/aura/test/event_generator.h" | 24 #include "ui/aura/test/event_generator.h" |
25 #include "ui/aura/window.h" | 25 #include "ui/aura/window.h" |
| 26 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
26 | 27 |
27 namespace content { | 28 namespace content { |
28 | 29 |
29 // A dummy callback to reset the screenshot-taker callback. | 30 // A dummy callback to reset the screenshot-taker callback. |
30 void DummyCallback(RenderViewHost* host) { | 31 void DummyCallback(RenderViewHost* host) { |
31 } | 32 } |
32 | 33 |
33 // This class keeps track of the RenderViewHost whose screenshot was captured. | 34 // This class keeps track of the RenderViewHost whose screenshot was captured. |
34 class ScreenshotTracker { | 35 class ScreenshotTracker { |
35 public: | 36 public: |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 #endif | 214 #endif |
214 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, | 215 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, |
215 MAYBE_QuickOverscrollDirectionChange) { | 216 MAYBE_QuickOverscrollDirectionChange) { |
216 ASSERT_NO_FATAL_FAILURE( | 217 ASSERT_NO_FATAL_FAILURE( |
217 StartTestWithPage("files/overscroll_navigation.html")); | 218 StartTestWithPage("files/overscroll_navigation.html")); |
218 WebContentsImpl* web_contents = | 219 WebContentsImpl* web_contents = |
219 static_cast<WebContentsImpl*>(shell()->web_contents()); | 220 static_cast<WebContentsImpl*>(shell()->web_contents()); |
220 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>( | 221 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>( |
221 web_contents->GetRenderViewHost()); | 222 web_contents->GetRenderViewHost()); |
222 | 223 |
| 224 // This test triggers a large number of animations. Speed them up to ensure |
| 225 // the test completes within its time limit. |
| 226 ui::ScopedAnimationDurationScaleMode fast_duration_mode( |
| 227 ui::ScopedAnimationDurationScaleMode::FAST_DURATION); |
| 228 |
223 // Make sure the page has both back/forward history. | 229 // Make sure the page has both back/forward history. |
224 ExecuteSyncJSFunction(view_host, "navigate_next()"); | 230 ExecuteSyncJSFunction(view_host, "navigate_next()"); |
225 EXPECT_EQ(1, GetCurrentIndex()); | 231 EXPECT_EQ(1, GetCurrentIndex()); |
226 ExecuteSyncJSFunction(view_host, "navigate_next()"); | 232 ExecuteSyncJSFunction(view_host, "navigate_next()"); |
227 EXPECT_EQ(2, GetCurrentIndex()); | 233 EXPECT_EQ(2, GetCurrentIndex()); |
228 web_contents->GetController().GoBack(); | 234 web_contents->GetController().GoBack(); |
229 EXPECT_EQ(1, GetCurrentIndex()); | 235 EXPECT_EQ(1, GetCurrentIndex()); |
230 | 236 |
231 aura::Window* content = web_contents->GetView()->GetContentNativeView(); | 237 aura::Window* content = web_contents->GetView()->GetContentNativeView(); |
232 aura::RootWindow* root_window = content->GetRootWindow(); | 238 aura::RootWindow* root_window = content->GetRootWindow(); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 web_contents->GetController().GetEntryAtOffset(-1)); | 423 web_contents->GetController().GetEntryAtOffset(-1)); |
418 EXPECT_TRUE(entry->screenshot().get()); | 424 EXPECT_TRUE(entry->screenshot().get()); |
419 | 425 |
420 entry = NavigationEntryImpl::FromNavigationEntry( | 426 entry = NavigationEntryImpl::FromNavigationEntry( |
421 web_contents->GetController().GetActiveEntry()); | 427 web_contents->GetController().GetActiveEntry()); |
422 EXPECT_FALSE(entry->screenshot().get()); | 428 EXPECT_FALSE(entry->screenshot().get()); |
423 } | 429 } |
424 } | 430 } |
425 | 431 |
426 } // namespace content | 432 } // namespace content |
OLD | NEW |