OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |