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

Side by Side Diff: ui/views/controls/webview/webview_unittest.cc

Issue 1898633004: Views: Add new SetFocusBehavior method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 7 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 | « ui/views/controls/webview/webview.cc ('k') | ui/views/examples/button_example.cc » ('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 "ui/views/controls/webview/webview.h" 5 #include "ui/views/controls/webview/webview.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 394 }
395 395
396 // Tests that clicking anywhere within the bounds of WebView, and either outside 396 // Tests that clicking anywhere within the bounds of WebView, and either outside
397 // or inside the bounds of its child NativeViewHost, causes WebView to gain 397 // or inside the bounds of its child NativeViewHost, causes WebView to gain
398 // focus. 398 // focus.
399 TEST_F(WebViewUnitTest, EmbeddedFullscreenDuringScreenCapture_ClickToFocus) { 399 TEST_F(WebViewUnitTest, EmbeddedFullscreenDuringScreenCapture_ClickToFocus) {
400 // For this test, add another View that can take focus away from WebView. 400 // For this test, add another View that can take focus away from WebView.
401 web_view()->SetBoundsRect(gfx::Rect(0, 0, 100, 90)); 401 web_view()->SetBoundsRect(gfx::Rect(0, 0, 100, 90));
402 views::View* const something_to_focus = new views::View(); 402 views::View* const something_to_focus = new views::View();
403 something_to_focus->SetBoundsRect(gfx::Rect(0, 90, 100, 10)); 403 something_to_focus->SetBoundsRect(gfx::Rect(0, 90, 100, 10));
404 something_to_focus->SetFocusable(true); 404 something_to_focus->SetFocusBehavior(View::FocusBehavior::ALWAYS);
405 top_level_widget()->GetContentsView()->AddChildView(something_to_focus); 405 top_level_widget()->GetContentsView()->AddChildView(something_to_focus);
406 406
407 web_view()->SetEmbedFullscreenWidgetMode(true); 407 web_view()->SetEmbedFullscreenWidgetMode(true);
408 ASSERT_EQ(1, web_view()->child_count()); 408 ASSERT_EQ(1, web_view()->child_count());
409 409
410 const std::unique_ptr<content::WebContents> web_contents(CreateWebContents()); 410 const std::unique_ptr<content::WebContents> web_contents(CreateWebContents());
411 WebViewTestWebContentsDelegate delegate; 411 WebViewTestWebContentsDelegate delegate;
412 web_contents->SetDelegate(&delegate); 412 web_contents->SetDelegate(&delegate);
413 web_view()->SetWebContents(web_contents.get()); 413 web_view()->SetWebContents(web_contents.get());
414 414
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 476
477 // Remove WebView from views hierarchy. NativeView should be detached 477 // Remove WebView from views hierarchy. NativeView should be detached
478 // from Widget. 478 // from Widget.
479 contents_view->RemoveChildView(webview.get()); 479 contents_view->RemoveChildView(webview.get());
480 // Destroy WebView. NativeView should be detached secondary. 480 // Destroy WebView. NativeView should be detached secondary.
481 // There should be no crash. 481 // There should be no crash.
482 webview.reset(); 482 webview.reset();
483 } 483 }
484 484
485 } // namespace views 485 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/webview/webview.cc ('k') | ui/views/examples/button_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698