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

Side by Side Diff: content/browser/screen_orientation/screen_orientation_browsertest.cc

Issue 436603002: Enable Screen Orientation integration tests for Chrome OS and Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@reduce_flakiness
Patch Set: fix android 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/public/test/browser_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 std::string type; 82 std::string type;
83 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), 83 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(),
84 "screen.orientation.type")->GetAsString(&type); 84 "screen.orientation.type")->GetAsString(&type);
85 return type; 85 return type;
86 } 86 }
87 87
88 private: 88 private:
89 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationBrowserTest); 89 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationBrowserTest);
90 }; 90 };
91 91
92 #if !defined(OS_ANDROID) && !defined(OS_MACOSX) && !defined(OS_CHROMEOS) 92 // This test doesn't work on MacOS X but the reason is mostly because it is not
93 IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, OrientationChange) { 93 // used Aura. It could be set as !defined(OS_MACOSX) but the rule below will
94 // actually support MacOS X if and when it switches to Aura.
95 #if defined(USE_AURA) || defined(OS_ANDROID)
96 IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, ScreenOrientationChange) {
94 std::string types[] = { "portrait-primary", 97 std::string types[] = { "portrait-primary",
95 "portrait-secondary", 98 "portrait-secondary",
96 "landscape-primary", 99 "landscape-primary",
97 "landscape-secondary" }; 100 "landscape-secondary" };
98 GURL test_url = GetTestUrl("screen_orientation", 101 GURL test_url = GetTestUrl("screen_orientation",
99 "screen_orientation_orientationchange.html"); 102 "screen_orientation_orientationchange.html");
100 103
101 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); 104 TestNavigationObserver navigation_observer(
105 shell()->web_contents(), 1
106 // Android doesn't paint (ie. UseSoftwareCompositing() has no effect) so we
107 // shouldn't wait for the first paint.
108 #if !defined(OS_ANDROID)
109 , TestNavigationObserver::FirstPaintRequired
110 #endif
111 );
102 shell()->LoadURL(test_url); 112 shell()->LoadURL(test_url);
103 navigation_observer.Wait(); 113 navigation_observer.Wait();
104 114
105 int angle = GetOrientationAngle(); 115 int angle = GetOrientationAngle();
106 116
107 for (int i = 0; i < 4; ++i) { 117 for (int i = 0; i < 4; ++i) {
108 angle = (angle + 90) % 360; 118 angle = (angle + 90) % 360;
109 SendFakeScreenOrientation(angle, types[i]); 119 SendFakeScreenOrientation(angle, types[i]);
110 120
111 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); 121 TestNavigationObserver navigation_observer(shell()->web_contents());
112 navigation_observer.Wait(); 122 navigation_observer.Wait();
113 EXPECT_EQ(angle, GetOrientationAngle()); 123 EXPECT_EQ(angle, GetOrientationAngle());
114 EXPECT_EQ(types[i], GetOrientationType()); 124 EXPECT_EQ(types[i], GetOrientationType());
115 } 125 }
116 } 126 }
117 #endif // !defined(OS_ANDROID) && !defined(OS_MACOSX) && !defined(OS_CHROMEOS) 127 #endif // defined(USE_AURA) || defined(OS_ANDROID)
118 128
119 } // namespace content 129 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/public/test/browser_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698