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