| Index: content/browser/screen_orientation/screen_orientation_browsertest.cc
|
| diff --git a/content/browser/screen_orientation/screen_orientation_browsertest.cc b/content/browser/screen_orientation/screen_orientation_browsertest.cc
|
| index 94e1a00cf2cca3fe60450e3395c4b3e1c504957a..670a3d031415b364c767e873481392d1bb23839b 100644
|
| --- a/content/browser/screen_orientation/screen_orientation_browsertest.cc
|
| +++ b/content/browser/screen_orientation/screen_orientation_browsertest.cc
|
| @@ -85,6 +85,20 @@ class ScreenOrientationBrowserTest : public ContentBrowserTest {
|
| return type;
|
| }
|
|
|
| + bool WindowOrientationSupported() {
|
| + bool support;
|
| + ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(),
|
| + "'orientation' in window")->GetAsBoolean(&support);
|
| + return support;
|
| + }
|
| +
|
| + int GetWindowOrientationAngle() {
|
| + int angle;
|
| + ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(),
|
| + "window.orientation")->GetAsInteger(&angle);
|
| + return angle;
|
| + }
|
| +
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(ScreenOrientationBrowserTest);
|
| };
|
| @@ -99,7 +113,7 @@ IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, ScreenOrientationChange) {
|
| "landscape-primary",
|
| "landscape-secondary" };
|
| GURL test_url = GetTestUrl("screen_orientation",
|
| - "screen_orientation_orientationchange.html");
|
| + "screen_orientation_screenorientationchange.html");
|
|
|
| TestNavigationObserver navigation_observer(
|
| shell()->web_contents(), 1
|
| @@ -126,4 +140,27 @@ IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, ScreenOrientationChange) {
|
| }
|
| #endif // defined(USE_AURA) || defined(OS_ANDROID)
|
|
|
| +IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, WindowOrientationChange) {
|
| + GURL test_url = GetTestUrl("screen_orientation",
|
| + "screen_orientation_windoworientationchange.html");
|
| +
|
| + TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
|
| + shell()->LoadURL(test_url);
|
| + navigation_observer.Wait();
|
| +
|
| + if (!WindowOrientationSupported())
|
| + return;
|
| +
|
| + int angle = GetWindowOrientationAngle();
|
| +
|
| + for (int i = 0; i < 4; ++i) {
|
| + angle = (angle + 90) % 360;
|
| + SendFakeScreenOrientation(angle, "portrait-primary");
|
| +
|
| + TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
|
| + navigation_observer.Wait();
|
| + EXPECT_EQ(angle == 270 ? -90 : angle, GetWindowOrientationAngle());
|
| + }
|
| +}
|
| +
|
| } // namespace content
|
|
|