| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 475 |
| 476 // Remove WebView from views hierarchy. NativeView should be detached | 476 // Remove WebView from views hierarchy. NativeView should be detached |
| 477 // from Widget. | 477 // from Widget. |
| 478 contents_view->RemoveChildView(webview.get()); | 478 contents_view->RemoveChildView(webview.get()); |
| 479 // Destroy WebView. NativeView should be detached secondary. | 479 // Destroy WebView. NativeView should be detached secondary. |
| 480 // There should be no crash. | 480 // There should be no crash. |
| 481 webview.reset(); | 481 webview.reset(); |
| 482 } | 482 } |
| 483 | 483 |
| 484 } // namespace views | 484 } // namespace views |
| OLD | NEW |