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

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

Issue 441713002: Use WaitForResizeComplete() instead of waiting for first paint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/test_navigation_observer.h » ('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"
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
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
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
OLDNEW
« no previous file with comments | « no previous file | content/public/test/test_navigation_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698