Chromium Code Reviews| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/stringprintf.h" | |
| 9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 10 #include "content/browser/frame_host/frame_tree.h" | 11 #include "content/browser/frame_host/frame_tree.h" |
| 11 #include "content/browser/frame_host/render_frame_host_impl.h" | 12 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 12 #include "content/browser/renderer_host/render_widget_host_impl.h" | 13 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 13 #include "content/browser/web_contents/web_contents_impl.h" | 14 #include "content/browser/web_contents/web_contents_impl.h" |
| 14 #include "content/common/page_messages.h" | 15 #include "content/common/page_messages.h" |
| 15 #include "content/common/view_messages.h" | 16 #include "content/common/view_messages.h" |
| 16 #include "content/public/browser/render_widget_host.h" | 17 #include "content/public/browser/render_widget_host.h" |
| 17 #include "content/public/browser/render_widget_host_view.h" | 18 #include "content/public/browser/render_widget_host_view.h" |
| 18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 &orientation_type)); | 349 &orientation_type)); |
| 349 EXPECT_EQ(types[i], orientation_type); | 350 EXPECT_EQ(types[i], orientation_type); |
| 350 EXPECT_TRUE(ExecuteScriptAndExtractString( | 351 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 351 child->current_frame_host(), | 352 child->current_frame_host(), |
| 352 "window.domAutomationController.send(screen.orientation.type)", | 353 "window.domAutomationController.send(screen.orientation.type)", |
| 353 &orientation_type)); | 354 &orientation_type)); |
| 354 EXPECT_EQ(types[i], orientation_type); | 355 EXPECT_EQ(types[i], orientation_type); |
| 355 } | 356 } |
| 356 } | 357 } |
| 357 | 358 |
| 359 #ifdef OS_ANDROID | |
| 360 IN_PROC_BROWSER_TEST_F(ScreenOrientationOOPIFBrowserTest, | |
| 361 DISABLED_ScreenOrientationLock) { | |
|
Charlie Reis
2017/06/06 22:41:37
Please include a comment for why this is disabled.
lfg
2017/06/07 22:30:57
Done.
| |
| 362 GURL main_url(embedded_test_server()->GetURL( | |
| 363 "a.com", "/cross_site_iframe_factory.html?a(b)")); | |
| 364 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | |
| 365 WaitForResizeComplete(shell()->web_contents()); | |
| 366 | |
| 367 const char* types[] = {"portrait-primary", "portrait-secondary", | |
| 368 "landscape-primary", "landscape-secondary"}; | |
| 369 | |
| 370 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | |
| 371 FrameTreeNode* child = root->child_at(0); | |
| 372 RenderFrameHostImpl* frames[] = {root->current_frame_host(), | |
| 373 child->current_frame_host()}; | |
| 374 | |
| 375 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), | |
| 376 "document.body.webkitRequestFullscreen()")); | |
| 377 for (const char* type : types) { | |
| 378 std::string script = | |
| 379 base::StringPrintf("screen.orientation.lock('%s')", type); | |
| 380 EXPECT_TRUE(ExecuteScript(child->current_frame_host(), script)); | |
| 381 | |
| 382 for (auto* frame : frames) { | |
| 383 std::string orientation_type; | |
| 384 while (type != orientation_type) { | |
| 385 EXPECT_TRUE(ExecuteScriptAndExtractString( | |
| 386 frame, | |
| 387 "window.domAutomationController.send(screen.orientation.type)", | |
| 388 &orientation_type)); | |
| 389 } | |
| 390 } | |
| 391 | |
| 392 EXPECT_TRUE(ExecuteScript(child->current_frame_host(), | |
| 393 "screen.orientation.unlock()")); | |
| 394 } | |
| 395 } | |
| 396 #endif // OS_ANDROID | |
| 397 | |
| 358 } // namespace content | 398 } // namespace content |
| OLD | NEW |