OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/location.h" | 6 #include "base/location.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // The delegate deletes itself. | 124 // The delegate deletes itself. |
125 WebDialogDelegate* delegate = new ui::test::TestWebDialogDelegate( | 125 WebDialogDelegate* delegate = new ui::test::TestWebDialogDelegate( |
126 GURL(chrome::kChromeUIConstrainedHTMLTestURL)); | 126 GURL(chrome::kChromeUIConstrainedHTMLTestURL)); |
127 WebContents* web_contents = | 127 WebContents* web_contents = |
128 browser()->tab_strip_model()->GetActiveWebContents(); | 128 browser()->tab_strip_model()->GetActiveWebContents(); |
129 ASSERT_TRUE(web_contents); | 129 ASSERT_TRUE(web_contents); |
130 | 130 |
131 ConstrainedWebDialogDelegate* dialog_delegate = | 131 ConstrainedWebDialogDelegate* dialog_delegate = |
132 ShowConstrainedWebDialog(browser()->profile(), delegate, web_contents); | 132 ShowConstrainedWebDialog(browser()->profile(), delegate, web_contents); |
133 ASSERT_TRUE(dialog_delegate); | 133 ASSERT_TRUE(dialog_delegate); |
134 scoped_ptr<WebContents> new_tab(dialog_delegate->GetWebContents()); | 134 std::unique_ptr<WebContents> new_tab(dialog_delegate->GetWebContents()); |
135 ASSERT_TRUE(new_tab.get()); | 135 ASSERT_TRUE(new_tab.get()); |
136 ASSERT_TRUE(IsShowingWebContentsModalDialog(web_contents)); | 136 ASSERT_TRUE(IsShowingWebContentsModalDialog(web_contents)); |
137 | 137 |
138 ConstrainedWebDialogBrowserTestObserver observer(new_tab.get()); | 138 ConstrainedWebDialogBrowserTestObserver observer(new_tab.get()); |
139 dialog_delegate->ReleaseWebContentsOnDialogClose(); | 139 dialog_delegate->ReleaseWebContentsOnDialogClose(); |
140 dialog_delegate->OnDialogCloseFromWebUI(); | 140 dialog_delegate->OnDialogCloseFromWebUI(); |
141 | 141 |
142 ASSERT_FALSE(observer.contents_destroyed()); | 142 ASSERT_FALSE(observer.contents_destroyed()); |
143 EXPECT_FALSE(IsShowingWebContentsModalDialog(web_contents)); | 143 EXPECT_FALSE(IsShowingWebContentsModalDialog(web_contents)); |
144 new_tab.reset(); | 144 new_tab.reset(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 dialog_delegate))); | 264 dialog_delegate))); |
265 | 265 |
266 // Resize <body> to dimension larger than dialog. | 266 // Resize <body> to dimension larger than dialog. |
267 EXPECT_TRUE(ExecuteScript(dialog_delegate->GetWebContents(), | 267 EXPECT_TRUE(ExecuteScript(dialog_delegate->GetWebContents(), |
268 GetChangeDimensionsScript(500))); | 268 GetChangeDimensionsScript(500))); |
269 ASSERT_TRUE(RunLoopUntil(base::Bind( | 269 ASSERT_TRUE(RunLoopUntil(base::Bind( |
270 &IsEqualSizes, | 270 &IsEqualSizes, |
271 initial_dialog_size, | 271 initial_dialog_size, |
272 dialog_delegate))); | 272 dialog_delegate))); |
273 } | 273 } |
OLD | NEW |