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

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

Issue 653283007: Tests for CL 647933003. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win8 Created 6 years, 1 month 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/test/data/screen_orientation/detached-iframe.html » ('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 14 matching lines...) Expand all
25 #include "base/win/windows_version.h" 25 #include "base/win/windows_version.h"
26 #endif // OS_WIN 26 #endif // OS_WIN
27 27
28 namespace content { 28 namespace content {
29 29
30 class ScreenOrientationBrowserTest : public ContentBrowserTest { 30 class ScreenOrientationBrowserTest : public ContentBrowserTest {
31 public: 31 public:
32 ScreenOrientationBrowserTest() { 32 ScreenOrientationBrowserTest() {
33 } 33 }
34 34
35 void SetUpCommandLine(CommandLine* command_line) override {
36 command_line->AppendSwitch(
37 switches::kEnableExperimentalWebPlatformFeatures);
38 }
39
40 void SetUp() override { 35 void SetUp() override {
41 // Painting has to happen otherwise the Resize messages will be added on top 36 // Painting has to happen otherwise the Resize messages will be added on top
42 // of each other without properly ack-painting which will fail and crash. 37 // of each other without properly ack-painting which will fail and crash.
43 UseSoftwareCompositing(); 38 UseSoftwareCompositing();
44 39
45 ContentBrowserTest::SetUp(); 40 ContentBrowserTest::SetUp();
46 } 41 }
47 42
48 protected: 43 protected:
49 void SendFakeScreenOrientation(unsigned angle, const std::string& strType) { 44 void SendFakeScreenOrientation(unsigned angle, const std::string& strType) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 std::string expected = 203 std::string expected =
209 #if defined(OS_ANDROID) 204 #if defined(OS_ANDROID)
210 "SecurityError"; // WebContents need to be fullscreen. 205 "SecurityError"; // WebContents need to be fullscreen.
211 #else 206 #else
212 "NotSupportedError"; // Locking isn't supported. 207 "NotSupportedError"; // Locking isn't supported.
213 #endif 208 #endif
214 209
215 EXPECT_EQ(expected, shell()->web_contents()->GetLastCommittedURL().ref()); 210 EXPECT_EQ(expected, shell()->web_contents()->GetLastCommittedURL().ref());
216 } 211 }
217 212
213 // Check that using screen orientation after a frame is detached doesn't crash
214 // the renderer process.
215 // This could be a LayoutTest if they were not using a mock screen orientation
216 // controller.
217 IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, CrashTest_UseAfterDetach) {
218 GURL test_url = GetTestUrl("screen_orientation",
219 "screen_orientation_use_after_detach.html");
220
221 TestNavigationObserver navigation_observer(shell()->web_contents(), 2);
222 shell()->LoadURL(test_url);
223
224 #if defined(OS_WIN)
225 // Screen Orientation is currently disabled on Windows 8.
226 // When implemented, this test will break, requiring an update.
227 if (base::win::OSInfo::GetInstance()->version() >= base::win::VERSION_WIN8) {
228 EXPECT_EQ(false, ScreenOrientationSupported());
229 return;
230 }
231 #endif // defined(OS_WIN)
232
233 navigation_observer.Wait();
234
235 // This is a success if the renderer process did not crash, thus, we end up
236 // here.
237 }
238
218 } // namespace content 239 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/data/screen_orientation/detached-iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698