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

Side by Side Diff: chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc

Issue 2451143003: <webview>: Correctly shift focus between WebContents. (Closed)
Patch Set: Address wjmaclean comment: ternary op. Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 "WebViewInteractiveTest.WebViewButtonWasFocused"); 1354 "WebViewInteractiveTest.WebViewButtonWasFocused");
1355 SendMessageToEmbedder("verify"); 1355 SendMessageToEmbedder("verify");
1356 EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied()); 1356 EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied());
1357 } 1357 }
1358 1358
1359 IN_PROC_BROWSER_TEST_P(WebViewInteractiveTest, KeyboardFocus) { 1359 IN_PROC_BROWSER_TEST_P(WebViewInteractiveTest, KeyboardFocus) {
1360 TestHelper("testKeyboardFocus", "web_view/focus", NO_TEST_SERVER); 1360 TestHelper("testKeyboardFocus", "web_view/focus", NO_TEST_SERVER);
1361 1361
1362 EXPECT_EQ(embedder_web_contents()->GetFocusedFrame(), 1362 EXPECT_EQ(embedder_web_contents()->GetFocusedFrame(),
1363 embedder_web_contents()->GetMainFrame()); 1363 embedder_web_contents()->GetMainFrame());
1364 content::FrameFocusedObserver focus_observer( 1364 content::FrameFocusedObserver focus_observer(
lfg 2016/10/27 20:00:35 Is this still needed?
avallee 2016/10/28 19:19:56 Gone.
1365 guest_web_contents()->GetMainFrame()); 1365 guest_web_contents()->GetMainFrame());
1366 ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false); 1366 ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
1367 next_step_listener.set_failure_message("TEST_STEP_FAILED"); 1367 next_step_listener.set_failure_message("TEST_STEP_FAILED");
1368 { 1368 {
1369 gfx::Rect offset = embedder_web_contents()->GetContainerBounds(); 1369 gfx::Rect offset = embedder_web_contents()->GetContainerBounds();
1370 // Click the <input> element inside the <webview>. 1370 // Click the <input> element inside the <webview>.
1371 // If we wanted, we could ask the embedder to compute an appropriate point. 1371 // If we wanted, we could ask the embedder to compute an appropriate point.
1372 MoveMouseInsideWindow(gfx::Point(offset.x() + 40, offset.y() + 40)); 1372 MoveMouseInsideWindow(gfx::Point(offset.x() + 40, offset.y() + 40));
1373 SendMouseClick(ui_controls::LEFT); 1373 SendMouseClick(ui_controls::LEFT);
1374 } 1374 }
1375 1375
1376 // Waits for the renderer to know the input has focus. 1376 // Waits for the renderer to know the input has focus.
1377 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied()); 1377 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied());
1378 // Wait for the browser to know which frame has focus.
1379 focus_observer.Wait();
1380 if (GetParam())
1381 EXPECT_EQ(embedder_web_contents()->GetFocusedFrame(), nullptr);
alexmos 2016/10/28 06:36:39 Why isn't this needed anymore?
avallee 2016/10/28 19:19:56 This is no longer needed as the click itself is wh
1382 1378
1383 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( 1379 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
1384 GetPlatformAppWindow(), ui::VKEY_A, false, false, false, false)); 1380 GetPlatformAppWindow(), ui::VKEY_A, false, false, false, false));
1385 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( 1381 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
1386 GetPlatformAppWindow(), ui::VKEY_B, false, true, false, false)); 1382 GetPlatformAppWindow(), ui::VKEY_B, false, true, false, false));
1387 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( 1383 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
1388 GetPlatformAppWindow(), ui::VKEY_C, false, false, false, false)); 1384 GetPlatformAppWindow(), ui::VKEY_C, false, false, false, false));
1389 1385
1390 next_step_listener.Reset(); 1386 next_step_listener.Reset();
1391 EXPECT_TRUE(content::ExecuteScript( 1387 EXPECT_TRUE(content::ExecuteScript(
1392 embedder_web_contents(), 1388 embedder_web_contents(),
1393 "window.runCommand('testKeyboardFocusRunNextStep', 'aBc');")); 1389 "window.runCommand('testKeyboardFocusRunNextStep', 'aBc');"));
1394 1390
1395 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied()); 1391 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied());
1396 } 1392 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree.cc » ('j') | content/browser/renderer_host/render_widget_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698