Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/extensions/extension_browsertest.h" | 12 #include "chrome/browser/extensions/extension_browsertest.h" |
| 12 #include "chrome/browser/extensions/extension_icon_manager.h" | 13 #include "chrome/browser/extensions/extension_icon_manager.h" |
| 13 #include "chrome/browser/extensions/extension_install_prompt.h" | 14 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 14 #include "chrome/browser/extensions/extension_install_prompt_test_helper.h" | 15 #include "chrome/browser/extensions/extension_install_prompt_test_helper.h" |
| 15 #include "chrome/browser/platform_util.h" | 16 #include "chrome/browser/platform_util.h" |
| 16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 19 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" | 20 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 { | 196 { |
| 196 // Dialog is closed without the user explicitly choosing to proceed or | 197 // Dialog is closed without the user explicitly choosing to proceed or |
| 197 // cancel. | 198 // cancel. |
| 198 ExtensionInstallPromptTestHelper helper; | 199 ExtensionInstallPromptTestHelper helper; |
| 199 views::DialogDelegateView* delegate_view = CreateAndShowPrompt(&helper); | 200 views::DialogDelegateView* delegate_view = CreateAndShowPrompt(&helper); |
| 200 delegate_view->GetWidget()->Close(); | 201 delegate_view->GetWidget()->Close(); |
| 201 // TODO(devlin): Should this be ABORTED? | 202 // TODO(devlin): Should this be ABORTED? |
| 202 EXPECT_EQ(ExtensionInstallPrompt::Result::USER_CANCELED, helper.result()); | 203 EXPECT_EQ(ExtensionInstallPrompt::Result::USER_CANCELED, helper.result()); |
| 203 } | 204 } |
| 204 } | 205 } |
| 206 | |
| 207 // Verifies that the "Add extension" button is disabled initally, but re-enabled | |
| 208 // after a short time delay. | |
| 209 IN_PROC_BROWSER_TEST_F(ExtensionInstallDialogViewTest, DelayInstalls) { | |
| 210 ExtensionInstallDialogView::SetInstallDelayForTesting(0); | |
| 211 ExtensionInstallPromptTestHelper helper; | |
| 212 views::DialogDelegateView* delegate_view = CreateAndShowPrompt(&helper); | |
|
Devlin
2017/03/31 22:21:41
Can we check that the dialog was, in fact, visible
Ackerman
2017/04/01 01:48:37
Done.
| |
| 213 | |
| 214 // Check initial button states. | |
| 215 EXPECT_FALSE(delegate_view->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); | |
| 216 EXPECT_TRUE(delegate_view->IsDialogButtonEnabled(ui::DIALOG_BUTTON_CANCEL)); | |
| 217 | |
| 218 // Check OK button state after timeout to verify that it is re-enabled. | |
| 219 base::RunLoop().RunUntilIdle(); | |
| 220 EXPECT_TRUE(delegate_view->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); | |
| 221 delegate_view->Close(); | |
| 222 } | |
| OLD | NEW |