| 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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 13 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
| 14 #endif | 14 #endif |
| 15 #include "content/browser/frame_host/navigation_controller_impl.h" | 15 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 16 #include "content/browser/frame_host/navigation_entry_impl.h" | 16 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 17 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" | 17 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" |
| 18 #include "content/browser/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
| 19 #include "content/browser/web_contents/web_contents_view.h" | 19 #include "content/browser/web_contents/web_contents_view.h" |
| 20 #include "content/common/view_messages.h" |
| 20 #include "content/public/browser/render_frame_host.h" | 21 #include "content/public/browser/render_frame_host.h" |
| 21 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
| 22 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 23 #include "content/public/test/browser_test_utils.h" | 24 #include "content/public/test/browser_test_utils.h" |
| 24 #include "content/public/test/content_browser_test.h" | 25 #include "content/public/test/content_browser_test.h" |
| 25 #include "content/public/test/content_browser_test_utils.h" | 26 #include "content/public/test/content_browser_test_utils.h" |
| 27 #include "content/public/test/test_renderer_host.h" |
| 26 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
| 27 #include "content/shell/browser/shell.h" | 29 #include "content/shell/browser/shell.h" |
| 28 #include "ui/aura/test/event_generator.h" | 30 #include "ui/aura/test/event_generator.h" |
| 29 #include "ui/aura/window.h" | 31 #include "ui/aura/window.h" |
| 30 #include "ui/aura/window_tree_host.h" | 32 #include "ui/aura/window_tree_host.h" |
| 31 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 33 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 32 #include "ui/events/event_processor.h" | 34 #include "ui/events/event_processor.h" |
| 33 | 35 |
| 34 namespace content { | 36 namespace content { |
| 35 | 37 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 controller->SetScreenshotManager(screenshot_manager_); | 154 controller->SetScreenshotManager(screenshot_manager_); |
| 153 } | 155 } |
| 154 | 156 |
| 155 void TestOverscrollNavigation(bool touch_handler) { | 157 void TestOverscrollNavigation(bool touch_handler) { |
| 156 ASSERT_NO_FATAL_FAILURE( | 158 ASSERT_NO_FATAL_FAILURE( |
| 157 StartTestWithPage("files/overscroll_navigation.html")); | 159 StartTestWithPage("files/overscroll_navigation.html")); |
| 158 WebContentsImpl* web_contents = | 160 WebContentsImpl* web_contents = |
| 159 static_cast<WebContentsImpl*>(shell()->web_contents()); | 161 static_cast<WebContentsImpl*>(shell()->web_contents()); |
| 160 NavigationController& controller = web_contents->GetController(); | 162 NavigationController& controller = web_contents->GetController(); |
| 161 RenderFrameHost* main_frame = web_contents->GetMainFrame(); | 163 RenderFrameHost* main_frame = web_contents->GetMainFrame(); |
| 162 WebContentsViewAura* view_aura = static_cast<WebContentsViewAura*>( | |
| 163 web_contents->GetView()); | |
| 164 view_aura->SetupOverlayWindowForTesting(); | |
| 165 | 164 |
| 166 EXPECT_FALSE(controller.CanGoBack()); | 165 EXPECT_FALSE(controller.CanGoBack()); |
| 167 EXPECT_FALSE(controller.CanGoForward()); | 166 EXPECT_FALSE(controller.CanGoForward()); |
| 168 int index = -1; | 167 int index = -1; |
| 169 scoped_ptr<base::Value> value = | 168 scoped_ptr<base::Value> value = |
| 170 content::ExecuteScriptAndGetValue(main_frame, "get_current()"); | 169 content::ExecuteScriptAndGetValue(main_frame, "get_current()"); |
| 171 ASSERT_TRUE(value->GetAsInteger(&index)); | 170 ASSERT_TRUE(value->GetAsInteger(&index)); |
| 172 EXPECT_EQ(0, index); | 171 EXPECT_EQ(0, index); |
| 173 | 172 |
| 174 if (touch_handler) | 173 if (touch_handler) |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 | 627 |
| 629 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, | 628 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, |
| 630 MAYBE_RepeatedQuickOverscrollGestures) { | 629 MAYBE_RepeatedQuickOverscrollGestures) { |
| 631 ASSERT_NO_FATAL_FAILURE( | 630 ASSERT_NO_FATAL_FAILURE( |
| 632 StartTestWithPage("files/overscroll_navigation.html")); | 631 StartTestWithPage("files/overscroll_navigation.html")); |
| 633 | 632 |
| 634 WebContentsImpl* web_contents = | 633 WebContentsImpl* web_contents = |
| 635 static_cast<WebContentsImpl*>(shell()->web_contents()); | 634 static_cast<WebContentsImpl*>(shell()->web_contents()); |
| 636 NavigationController& controller = web_contents->GetController(); | 635 NavigationController& controller = web_contents->GetController(); |
| 637 RenderFrameHost* main_frame = web_contents->GetMainFrame(); | 636 RenderFrameHost* main_frame = web_contents->GetMainFrame(); |
| 638 WebContentsViewAura* view_aura = static_cast<WebContentsViewAura*>( | |
| 639 web_contents->GetView()); | |
| 640 view_aura->SetupOverlayWindowForTesting(); | |
| 641 ExecuteSyncJSFunction(main_frame, "install_touch_handler()"); | 637 ExecuteSyncJSFunction(main_frame, "install_touch_handler()"); |
| 642 | 638 |
| 643 // Navigate twice, then navigate back in history once. | 639 // Navigate twice, then navigate back in history once. |
| 644 ExecuteSyncJSFunction(main_frame, "navigate_next()"); | 640 ExecuteSyncJSFunction(main_frame, "navigate_next()"); |
| 645 ExecuteSyncJSFunction(main_frame, "navigate_next()"); | 641 ExecuteSyncJSFunction(main_frame, "navigate_next()"); |
| 646 EXPECT_EQ(2, GetCurrentIndex()); | 642 EXPECT_EQ(2, GetCurrentIndex()); |
| 647 EXPECT_TRUE(controller.CanGoBack()); | 643 EXPECT_TRUE(controller.CanGoBack()); |
| 648 EXPECT_FALSE(controller.CanGoForward()); | 644 EXPECT_FALSE(controller.CanGoForward()); |
| 649 | 645 |
| 650 web_contents->GetController().GoBack(); | 646 web_contents->GetController().GoBack(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 678 10); | 674 10); |
| 679 base::string16 actual_title = title_watcher.WaitAndGetTitle(); | 675 base::string16 actual_title = title_watcher.WaitAndGetTitle(); |
| 680 EXPECT_EQ(expected_title, actual_title); | 676 EXPECT_EQ(expected_title, actual_title); |
| 681 | 677 |
| 682 EXPECT_EQ(2, GetCurrentIndex()); | 678 EXPECT_EQ(2, GetCurrentIndex()); |
| 683 EXPECT_TRUE(controller.CanGoBack()); | 679 EXPECT_TRUE(controller.CanGoBack()); |
| 684 EXPECT_FALSE(controller.CanGoForward()); | 680 EXPECT_FALSE(controller.CanGoForward()); |
| 685 } | 681 } |
| 686 | 682 |
| 687 } // namespace content | 683 } // namespace content |
| OLD | NEW |