Index: chrome/browser/ui/views/constrained_window_views_browsertest.cc |
diff --git a/chrome/browser/ui/views/constrained_window_views_browsertest.cc b/chrome/browser/ui/views/constrained_window_views_browsertest.cc |
index 8aee88696f33352d9f74aaeac77e97a054a10b54..0805734c735eaaaf3986616322e7161b28fd33d1 100644 |
--- a/chrome/browser/ui/views/constrained_window_views_browsertest.cc |
+++ b/chrome/browser/ui/views/constrained_window_views_browsertest.cc |
@@ -2,10 +2,9 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "components/constrained_window/constrained_window_views.h" |
+#include <memory> |
#include "base/macros.h" |
-#include "base/memory/scoped_ptr.h" |
#include "build/build_config.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_commands.h" |
@@ -15,6 +14,7 @@ |
#include "chrome/test/base/in_process_browser_test.h" |
#include "chrome/test/base/interactive_test_utils.h" |
#include "chrome/test/base/ui_test_utils.h" |
+#include "components/constrained_window/constrained_window_views.h" |
#include "components/web_modal/web_contents_modal_dialog_host.h" |
#include "components/web_modal/web_contents_modal_dialog_manager.h" |
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
@@ -46,8 +46,9 @@ class TestDialog : public views::DialogDelegateView { |
}; |
// A helper function to create and show a web contents modal dialog. |
-scoped_ptr<TestDialog> ShowModalDialog(content::WebContents* web_contents) { |
- scoped_ptr<TestDialog> dialog(new TestDialog()); |
+std::unique_ptr<TestDialog> ShowModalDialog( |
+ content::WebContents* web_contents) { |
+ std::unique_ptr<TestDialog> dialog(new TestDialog()); |
constrained_window::ShowWebModalDialogViews(dialog.get(), web_contents); |
return dialog; |
} |
@@ -63,7 +64,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) { |
content::WebContents* web_contents = |
browser()->tab_strip_model()->GetActiveWebContents(); |
EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); |
- scoped_ptr<TestDialog> dialog1 = ShowModalDialog(web_contents); |
+ std::unique_ptr<TestDialog> dialog1 = ShowModalDialog(web_contents); |
// |dialog1| should be active and focused. |
EXPECT_TRUE(dialog1->GetWidget()->IsVisible()); |
@@ -72,7 +73,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) { |
// Create a second dialog. This will also be modal to |web_contents|, but will |
// remain hidden since the |dialog1| is still showing. |
- scoped_ptr<TestDialog> dialog2 = ShowModalDialog(web_contents); |
+ std::unique_ptr<TestDialog> dialog2 = ShowModalDialog(web_contents); |
EXPECT_FALSE(dialog2->GetWidget()->IsVisible()); |
EXPECT_TRUE(dialog1->GetWidget()->IsVisible()); |
EXPECT_EQ(focus_manager, dialog2->GetWidget()->GetFocusManager()); |
@@ -111,8 +112,8 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) { |
// Tests that the tab-modal window is closed properly when its tab is closed. |
IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, TabCloseTest) { |
- scoped_ptr<TestDialog> dialog = ShowModalDialog( |
- browser()->tab_strip_model()->GetActiveWebContents()); |
+ std::unique_ptr<TestDialog> dialog = |
+ ShowModalDialog(browser()->tab_strip_model()->GetActiveWebContents()); |
EXPECT_TRUE(dialog->GetWidget()->IsVisible()); |
chrome::CloseTab(browser()); |
content::RunAllPendingInMessageLoop(); |
@@ -122,8 +123,8 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, TabCloseTest) { |
// Tests that the tab-modal window is hidden when an other tab is selected and |
// shown when its tab is selected again. |
IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, TabSwitchTest) { |
- scoped_ptr<TestDialog> dialog = ShowModalDialog( |
- browser()->tab_strip_model()->GetActiveWebContents()); |
+ std::unique_ptr<TestDialog> dialog = |
+ ShowModalDialog(browser()->tab_strip_model()->GetActiveWebContents()); |
EXPECT_TRUE(dialog->GetWidget()->IsVisible()); |
// Open a new tab. The tab-modal window should hide itself. |
@@ -144,7 +145,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, TabSwitchTest) { |
IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, TabMoveTest) { |
content::WebContents* web_contents = |
browser()->tab_strip_model()->GetActiveWebContents(); |
- scoped_ptr<TestDialog> dialog = ShowModalDialog(web_contents); |
+ std::unique_ptr<TestDialog> dialog = ShowModalDialog(web_contents); |
EXPECT_TRUE(dialog->GetWidget()->IsVisible()); |
// Move the tab to a second browser window; but first create another tab. |
@@ -178,7 +179,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, NavigationOnBackspace) { |
content::WaitForLoadStop(web_contents); |
EXPECT_EQ(GURL(chrome::kChromeUIVersionURL), web_contents->GetURL()); |
- scoped_ptr<TestDialog> dialog = ShowModalDialog(web_contents); |
+ std::unique_ptr<TestDialog> dialog = ShowModalDialog(web_contents); |
EXPECT_TRUE(dialog->GetWidget()->IsVisible()); |
EXPECT_EQ(dialog->GetContentsView(), |
dialog->GetWidget()->GetFocusManager()->GetFocusedView()); |
@@ -201,8 +202,8 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, ClosesOnEscape) { |
return; |
#endif |
- scoped_ptr<TestDialog> dialog = ShowModalDialog( |
- browser()->tab_strip_model()->GetActiveWebContents()); |
+ std::unique_ptr<TestDialog> dialog = |
+ ShowModalDialog(browser()->tab_strip_model()->GetActiveWebContents()); |
EXPECT_TRUE(dialog->GetWidget()->IsVisible()); |
EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, |
false, false, false, false)); |