| 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 619 |
| 621 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, | 620 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, |
| 622 MAYBE_RepeatedQuickOverscrollGestures) { | 621 MAYBE_RepeatedQuickOverscrollGestures) { |
| 623 ASSERT_NO_FATAL_FAILURE( | 622 ASSERT_NO_FATAL_FAILURE( |
| 624 StartTestWithPage("files/overscroll_navigation.html")); | 623 StartTestWithPage("files/overscroll_navigation.html")); |
| 625 | 624 |
| 626 WebContentsImpl* web_contents = | 625 WebContentsImpl* web_contents = |
| 627 static_cast<WebContentsImpl*>(shell()->web_contents()); | 626 static_cast<WebContentsImpl*>(shell()->web_contents()); |
| 628 NavigationController& controller = web_contents->GetController(); | 627 NavigationController& controller = web_contents->GetController(); |
| 629 RenderFrameHost* main_frame = web_contents->GetMainFrame(); | 628 RenderFrameHost* main_frame = web_contents->GetMainFrame(); |
| 630 WebContentsViewAura* view_aura = static_cast<WebContentsViewAura*>( | |
| 631 web_contents->GetView()); | |
| 632 view_aura->SetupOverlayWindowForTesting(); | |
| 633 ExecuteSyncJSFunction(main_frame, "install_touch_handler()"); | 629 ExecuteSyncJSFunction(main_frame, "install_touch_handler()"); |
| 634 | 630 |
| 635 // Navigate twice, then navigate back in history once. | 631 // Navigate twice, then navigate back in history once. |
| 636 ExecuteSyncJSFunction(main_frame, "navigate_next()"); | 632 ExecuteSyncJSFunction(main_frame, "navigate_next()"); |
| 637 ExecuteSyncJSFunction(main_frame, "navigate_next()"); | 633 ExecuteSyncJSFunction(main_frame, "navigate_next()"); |
| 638 EXPECT_EQ(2, GetCurrentIndex()); | 634 EXPECT_EQ(2, GetCurrentIndex()); |
| 639 EXPECT_TRUE(controller.CanGoBack()); | 635 EXPECT_TRUE(controller.CanGoBack()); |
| 640 EXPECT_FALSE(controller.CanGoForward()); | 636 EXPECT_FALSE(controller.CanGoForward()); |
| 641 | 637 |
| 642 web_contents->GetController().GoBack(); | 638 web_contents->GetController().GoBack(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 aura::Window* content = web_contents->GetNativeView()->parent(); | 680 aura::Window* content = web_contents->GetNativeView()->parent(); |
| 685 aura::Window* parent = content->parent(); | 681 aura::Window* parent = content->parent(); |
| 686 EXPECT_TRUE(web_contents->should_normally_be_visible()); | 682 EXPECT_TRUE(web_contents->should_normally_be_visible()); |
| 687 parent->Hide(); | 683 parent->Hide(); |
| 688 EXPECT_FALSE(web_contents->should_normally_be_visible()); | 684 EXPECT_FALSE(web_contents->should_normally_be_visible()); |
| 689 parent->Show(); | 685 parent->Show(); |
| 690 EXPECT_TRUE(web_contents->should_normally_be_visible()); | 686 EXPECT_TRUE(web_contents->should_normally_be_visible()); |
| 691 } | 687 } |
| 692 | 688 |
| 693 } // namespace content | 689 } // namespace content |
| OLD | NEW |