| 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
| 10 #include "content/public/browser/render_widget_host.h" | 10 #include "content/public/browser/render_widget_host.h" |
| 11 #include "content/public/browser/render_widget_host_view.h" | 11 #include "content/public/browser/render_widget_host_view.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 14 #include "content/public/test/browser_test_utils.h" |
| 14 #include "content/public/test/content_browser_test.h" | 15 #include "content/public/test/content_browser_test.h" |
| 15 #include "content/public/test/content_browser_test_utils.h" | 16 #include "content/public/test/content_browser_test_utils.h" |
| 16 #include "content/public/test/test_navigation_observer.h" | 17 #include "content/public/test/test_navigation_observer.h" |
| 17 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
| 18 #include "content/shell/browser/shell.h" | 19 #include "content/shell/browser/shell.h" |
| 19 #include "content/shell/common/shell_switches.h" | 20 #include "content/shell/common/shell_switches.h" |
| 20 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 21 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 21 #include "ui/compositor/compositor_switches.h" | 22 #include "ui/compositor/compositor_switches.h" |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // actually support MacOS X if and when it switches to Aura. | 109 // actually support MacOS X if and when it switches to Aura. |
| 109 #if defined(USE_AURA) || defined(OS_ANDROID) | 110 #if defined(USE_AURA) || defined(OS_ANDROID) |
| 110 IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, ScreenOrientationChange) { | 111 IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, ScreenOrientationChange) { |
| 111 std::string types[] = { "portrait-primary", | 112 std::string types[] = { "portrait-primary", |
| 112 "portrait-secondary", | 113 "portrait-secondary", |
| 113 "landscape-primary", | 114 "landscape-primary", |
| 114 "landscape-secondary" }; | 115 "landscape-secondary" }; |
| 115 GURL test_url = GetTestUrl("screen_orientation", | 116 GURL test_url = GetTestUrl("screen_orientation", |
| 116 "screen_orientation_screenorientationchange.html"); | 117 "screen_orientation_screenorientationchange.html"); |
| 117 | 118 |
| 118 TestNavigationObserver navigation_observer( | 119 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); |
| 119 shell()->web_contents(), 1 | |
| 120 // Android doesn't paint (ie. UseSoftwareCompositing() has no effect) so we | |
| 121 // shouldn't wait for the first paint. | |
| 122 #if !defined(OS_ANDROID) | |
| 123 , TestNavigationObserver::FirstPaintRequired | |
| 124 #endif | |
| 125 ); | |
| 126 shell()->LoadURL(test_url); | 120 shell()->LoadURL(test_url); |
| 127 navigation_observer.Wait(); | 121 navigation_observer.Wait(); |
| 122 #if USE_AURA |
| 123 WaitForResizeComplete(shell()->web_contents()); |
| 124 #endif // USE_AURA |
| 128 | 125 |
| 129 int angle = GetOrientationAngle(); | 126 int angle = GetOrientationAngle(); |
| 130 | 127 |
| 131 for (int i = 0; i < 4; ++i) { | 128 for (int i = 0; i < 4; ++i) { |
| 132 angle = (angle + 90) % 360; | 129 angle = (angle + 90) % 360; |
| 133 SendFakeScreenOrientation(angle, types[i]); | 130 SendFakeScreenOrientation(angle, types[i]); |
| 134 | 131 |
| 135 TestNavigationObserver navigation_observer(shell()->web_contents()); | 132 TestNavigationObserver navigation_observer(shell()->web_contents()); |
| 136 navigation_observer.Wait(); | 133 navigation_observer.Wait(); |
| 137 EXPECT_EQ(angle, GetOrientationAngle()); | 134 EXPECT_EQ(angle, GetOrientationAngle()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 157 angle = (angle + 90) % 360; | 154 angle = (angle + 90) % 360; |
| 158 SendFakeScreenOrientation(angle, "portrait-primary"); | 155 SendFakeScreenOrientation(angle, "portrait-primary"); |
| 159 | 156 |
| 160 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); | 157 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); |
| 161 navigation_observer.Wait(); | 158 navigation_observer.Wait(); |
| 162 EXPECT_EQ(angle == 270 ? -90 : angle, GetWindowOrientationAngle()); | 159 EXPECT_EQ(angle == 270 ? -90 : angle, GetWindowOrientationAngle()); |
| 163 } | 160 } |
| 164 } | 161 } |
| 165 | 162 |
| 166 } // namespace content | 163 } // namespace content |
| OLD | NEW |