diff options
author | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-27 23:31:26 +0000 |
---|---|---|
committer | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-27 23:31:26 +0000 |
commit | 5f67679cda14da9e23a205cfb630cc1ad223255e (patch) | |
tree | d689e7b06c5b92e0801b320b71ea61fdc29996d2 | |
parent | afd1e525b648613762191b3720ca9533eef358a8 (diff) | |
download | chromium_src-5f67679cda14da9e23a205cfb630cc1ad223255e.zip chromium_src-5f67679cda14da9e23a205cfb630cc1ad223255e.tar.gz chromium_src-5f67679cda14da9e23a205cfb630cc1ad223255e.tar.bz2 |
Fix browser tests that failed on windows because of open message boxes.
BUG=80606
TEST=none
Review URL: http://codereview.chromium.org/6883198
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83252 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/extension_install_ui.cc | 13 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_install_ui.h | 7 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_webstore_private_apitest.cc | 12 |
3 files changed, 25 insertions, 7 deletions
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index 912b8cf..e24a5d4 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -160,10 +160,18 @@ void ExtensionInstallUI::OnInstallSuccess(const Extension* extension, browser::ShowExtensionInstalledBubble(extension, browser, icon_, profile); } +namespace { + +bool disable_failure_ui_for_tests = false; + +} // namespace + void ExtensionInstallUI::OnInstallFailure(const std::string& error) { DCHECK(ui_loop_ == MessageLoop::current()); Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); + if (disable_failure_ui_for_tests) + return; platform_util::SimpleErrorBox( browser ? browser->window()->GetNativeHandle() : NULL, l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_FAILURE_TITLE), @@ -205,6 +213,11 @@ void ExtensionInstallUI::OnImageLoaded( } } +// static +void ExtensionInstallUI::DisableFailureUIForTests() { + disable_failure_ui_for_tests = true; +} + void ExtensionInstallUI::ShowThemeInfoBar(const std::string& previous_theme_id, bool previous_using_native_theme, const Extension* new_theme, diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_ui.h index 13974be..44e2f26 100644 --- a/chrome/browser/extensions/extension_install_ui.h +++ b/chrome/browser/extensions/extension_install_ui.h @@ -74,6 +74,13 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { virtual void OnImageLoaded( SkBitmap* image, const ExtensionResource& resource, int index); + protected: + friend class ExtensionWebstorePrivateApiTest; + + // Disables showing UI (ErrorBox, etc.) for install failures. To be used only + // in tests. + static void DisableFailureUIForTests(); + private: // Show an infobar for a newly-installed theme. previous_theme_id // should be empty if the previous theme was the system/default diff --git a/chrome/browser/extensions/extension_webstore_private_apitest.cc b/chrome/browser/extensions/extension_webstore_private_apitest.cc index d43399e..5c04f64 100644 --- a/chrome/browser/extensions/extension_webstore_private_apitest.cc +++ b/chrome/browser/extensions/extension_webstore_private_apitest.cc @@ -4,6 +4,7 @@ #include "base/stringprintf.h" #include "chrome/browser/extensions/extension_apitest.h" +#include "chrome/browser/extensions/extension_install_ui.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_webstore_private_api.h" #include "chrome/browser/profiles/profile.h" @@ -31,6 +32,7 @@ class ExtensionWebstorePrivateApiTest : public ExtensionApiTest { ASSERT_TRUE(test_server()->Start()); BeginInstallWithManifestFunction::SetIgnoreUserGestureForTests(true); BeginInstallWithManifestFunction::SetAutoConfirmForTests(true); + ExtensionInstallUI::DisableFailureUIForTests(); } protected: @@ -65,9 +67,7 @@ class ExtensionWebstorePrivateApiTest : public ExtensionApiTest { }; // Tests several basic install cases. -// TODO(asargent): disabled - see crbug.com/80606 for details. -IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, - DISABLED_Install) { +IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, Install) { // Test cases where the user accepts the install confirmation dialog. ASSERT_TRUE(RunInstallTest("accepted.html")); @@ -79,9 +79,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, ASSERT_TRUE(RunInstallTest("no_user_gesture.html")); } -// TODO(asargent): disabled - see crbug.com/80606 for details. IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, - DISABLED_IncorrectManifest1) { + IncorrectManifest1) { ui_test_utils::WindowedNotificationObserver observer( NotificationType::EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); @@ -89,9 +88,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, observer.Wait(); } -// TODO(asargent): disabled - see crbug.com/80606 for details. IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, - DISABLED_IncorrectManifest2) { + IncorrectManifest2) { ui_test_utils::WindowedNotificationObserver observer( NotificationType::EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); |