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 "chrome/browser/ui/views/extensions/extension_install_dialog_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_install_dialog_view.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
9 #include "chrome/browser/extensions/extension_icon_manager.h" | 9 #include "chrome/browser/extensions/extension_icon_manager.h" |
10 #include "chrome/browser/extensions/extension_install_prompt.h" | 10 #include "chrome/browser/extensions/extension_install_prompt.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 private: | 154 private: |
155 DISALLOW_COPY_AND_ASSIGN(ScrollbarTest); | 155 DISALLOW_COPY_AND_ASSIGN(ScrollbarTest); |
156 }; | 156 }; |
157 | 157 |
158 ScrollbarTest::ScrollbarTest() | 158 ScrollbarTest::ScrollbarTest() |
159 : ExtensionInstallDialogViewTestBase( | 159 : ExtensionInstallDialogViewTestBase( |
160 ExtensionInstallPrompt::PERMISSIONS_PROMPT) { | 160 ExtensionInstallPrompt::PERMISSIONS_PROMPT) { |
161 } | 161 } |
162 | 162 |
163 bool ScrollbarTest::IsScrollbarVisible() { | 163 bool ScrollbarTest::IsScrollbarVisible() { |
164 ExtensionInstallPrompt::ShowParams show_params(web_contents()); | |
165 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView( | 164 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView( |
166 show_params.profile, | 165 profile(), |
167 show_params.parent_web_contents, | 166 web_contents(), |
168 delegate(), | 167 delegate(), |
169 prompt()); | 168 prompt()); |
170 | 169 |
171 // Create the modal view around the install dialog view. | 170 // Create the modal view around the install dialog view. |
172 views::Widget* modal = | 171 views::Widget* modal = |
173 CreateBrowserModalDialogViews(dialog, show_params.parent_window); | 172 CreateBrowserModalDialogViews(dialog, |
| 173 web_contents()->GetTopLevelNativeWindow()); |
174 modal->Show(); | 174 modal->Show(); |
175 content::RunAllBlockingPoolTasksUntilIdle(); | 175 content::RunAllBlockingPoolTasksUntilIdle(); |
176 | 176 |
177 // Check if the vertical scrollbar is visible. | 177 // Check if the vertical scrollbar is visible. |
178 return dialog->scroll_view()->vertical_scroll_bar()->visible(); | 178 return dialog->scroll_view()->vertical_scroll_bar()->visible(); |
179 } | 179 } |
180 | 180 |
181 // Tests that a scrollbar _is_ shown for an excessively long extension | 181 // Tests that a scrollbar _is_ shown for an excessively long extension |
182 // install prompt. | 182 // install prompt. |
183 IN_PROC_BROWSER_TEST_F(ScrollbarTest, LongPromptScrollbar) { | 183 IN_PROC_BROWSER_TEST_F(ScrollbarTest, LongPromptScrollbar) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 MockExtensionInstallPromptDelegate delegate; | 260 MockExtensionInstallPromptDelegate delegate; |
261 scoped_ptr<ExtensionInstallDialogView> dialog( | 261 scoped_ptr<ExtensionInstallDialogView> dialog( |
262 new ExtensionInstallDialogView( | 262 new ExtensionInstallDialogView( |
263 profile(), web_contents(), &delegate, prompt())); | 263 profile(), web_contents(), &delegate, prompt())); |
264 dialog.reset(); | 264 dialog.reset(); |
265 | 265 |
266 EXPECT_EQ(1, delegate.abort_count()); | 266 EXPECT_EQ(1, delegate.abort_count()); |
267 EXPECT_EQ(0, delegate.proceed_count()); | 267 EXPECT_EQ(0, delegate.proceed_count()); |
268 } | 268 } |
269 } | 269 } |
OLD | NEW |