Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: content/browser/screen_orientation/screen_orientation_browsertest.cc

Issue 431103002: Add integration tests for window.orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screen_orientation_integration
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/ScreenOrientationIntegrationTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/ScreenOrientationIntegrationTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698