Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/browser/extensions/extension_browsertest.cc

Issue 6546072: Clean up how we handle themes in the extensions system and management API.... Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extensions/extension_browsertest.h" 5 #include "chrome/browser/extensions/extension_browsertest.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "chrome/browser/browser_window.h" 14 #include "chrome/browser/browser_window.h"
15 #include "chrome/browser/extensions/crx_installer.h" 15 #include "chrome/browser/extensions/crx_installer.h"
16 #include "chrome/browser/extensions/extension_creator.h" 16 #include "chrome/browser/extensions/extension_creator.h"
17 #include "chrome/browser/extensions/extension_error_reporter.h" 17 #include "chrome/browser/extensions/extension_error_reporter.h"
18 #include "chrome/browser/extensions/extension_host.h" 18 #include "chrome/browser/extensions/extension_host.h"
19 #include "chrome/browser/extensions/extension_install_ui.h" 19 #include "chrome/browser/extensions/extension_install_ui.h"
20 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
21 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/tab_contents/tab_contents.h"
22 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/omnibox/location_bar.h" 25 #include "chrome/browser/ui/omnibox/location_bar.h"
24 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/notification_registrar.h" 28 #include "chrome/common/notification_registrar.h"
27 #include "chrome/common/notification_service.h" 29 #include "chrome/common/notification_service.h"
28 #include "chrome/common/notification_type.h" 30 #include "chrome/common/notification_type.h"
29 #include "chrome/test/ui_test_utils.h" 31 #include "chrome/test/ui_test_utils.h"
30 32
31 ExtensionBrowserTest::ExtensionBrowserTest() 33 ExtensionBrowserTest::ExtensionBrowserTest()
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 virtual void ConfirmUninstall(Delegate* delegate, 158 virtual void ConfirmUninstall(Delegate* delegate,
157 const Extension* extension) {} 159 const Extension* extension) {}
158 160
159 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} 161 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {}
160 162
161 virtual void OnInstallFailure(const std::string& error) {} 163 virtual void OnInstallFailure(const std::string& error) {}
162 }; 164 };
163 165
164 class MockAutoConfirmExtensionInstallUI : public ExtensionInstallUI { 166 class MockAutoConfirmExtensionInstallUI : public ExtensionInstallUI {
165 public: 167 public:
166 MockAutoConfirmExtensionInstallUI(Profile* profile) : 168 explicit MockAutoConfirmExtensionInstallUI(Profile* profile) :
167 ExtensionInstallUI(profile) {} 169 ExtensionInstallUI(profile) {}
168 170
169 // Proceed without confirmation prompt. 171 // Proceed without confirmation prompt.
170 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { 172 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) {
171 delegate->InstallUIProceed(); 173 delegate->InstallUIProceed();
172 } 174 }
173 }; 175 };
174 176
175 bool ExtensionBrowserTest::InstallOrUpdateExtension(const std::string& id, 177 bool ExtensionBrowserTest::InstallOrUpdateExtension(const std::string& id,
176 const FilePath& path, 178 const FilePath& path,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 if (!service->GetExtensionById(extension_id, true)) { 351 if (!service->GetExtensionById(extension_id, true)) {
350 // The extension is already unloaded, presumably due to a crash. 352 // The extension is already unloaded, presumably due to a crash.
351 return true; 353 return true;
352 } 354 }
353 ui_test_utils::RegisterAndWait(this, 355 ui_test_utils::RegisterAndWait(this,
354 NotificationType::EXTENSION_PROCESS_TERMINATED, 356 NotificationType::EXTENSION_PROCESS_TERMINATED,
355 NotificationService::AllSources()); 357 NotificationService::AllSources());
356 return (service->GetExtensionById(extension_id, true) == NULL); 358 return (service->GetExtensionById(extension_id, true) == NULL);
357 } 359 }
358 360
361 void ExtensionBrowserTest::VerifyThemeInfoBarAndUndoInstall() {
362 TabContents* tab_contents = browser()->GetSelectedTabContents();
363 ASSERT_TRUE(tab_contents);
364 ASSERT_EQ(1U, tab_contents->infobar_count());
365 ConfirmInfoBarDelegate* delegate =
366 tab_contents->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate();
367 ASSERT_TRUE(delegate);
368 delegate->Cancel();
369 ASSERT_EQ(0U, tab_contents->infobar_count());
370 }
371
359 void ExtensionBrowserTest::Observe(NotificationType type, 372 void ExtensionBrowserTest::Observe(NotificationType type,
360 const NotificationSource& source, 373 const NotificationSource& source,
361 const NotificationDetails& details) { 374 const NotificationDetails& details) {
362 switch (type.value) { 375 switch (type.value) {
363 case NotificationType::EXTENSION_LOADED: 376 case NotificationType::EXTENSION_LOADED:
364 last_loaded_extension_id_ = Details<const Extension>(details).ptr()->id(); 377 last_loaded_extension_id_ = Details<const Extension>(details).ptr()->id();
365 VLOG(1) << "Got EXTENSION_LOADED notification."; 378 VLOG(1) << "Got EXTENSION_LOADED notification.";
366 MessageLoopForUI::current()->Quit(); 379 MessageLoopForUI::current()->Quit();
367 break; 380 break;
368 381
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 MessageLoopForUI::current()->Quit(); 435 MessageLoopForUI::current()->Quit();
423 } 436 }
424 break; 437 break;
425 } 438 }
426 439
427 default: 440 default:
428 NOTREACHED(); 441 NOTREACHED();
429 break; 442 break;
430 } 443 }
431 } 444 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.h ('k') | chrome/browser/extensions/extension_install_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698