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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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) 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 "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_util.h" 10 #include "base/file_util.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 public: 299 public:
300 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL) { 300 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL) {
301 } 301 }
302 302
303 // Simulate a user abort on an extension installation. 303 // Simulate a user abort on an extension installation.
304 virtual void ConfirmInstall( 304 virtual void ConfirmInstall(
305 Delegate* delegate, 305 Delegate* delegate,
306 const Extension* extension, 306 const Extension* extension,
307 const ShowDialogCallback& show_dialog_callback) OVERRIDE { 307 const ShowDialogCallback& show_dialog_callback) OVERRIDE {
308 delegate->InstallUIAbort(true); 308 delegate->InstallUIAbort(true);
309 MessageLoopForUI::current()->Quit(); 309 base::MessageLoopForUI::current()->Quit();
310 } 310 }
311 311
312 virtual void OnInstallSuccess(const Extension* extension, 312 virtual void OnInstallSuccess(const Extension* extension,
313 SkBitmap* icon) OVERRIDE {} 313 SkBitmap* icon) OVERRIDE {}
314 314
315 virtual void OnInstallFailure( 315 virtual void OnInstallFailure(
316 const extensions::CrxInstallerError& error) OVERRIDE {} 316 const extensions::CrxInstallerError& error) OVERRIDE {}
317 }; 317 };
318 318
319 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { 319 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt {
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 656
657 void ExtensionBrowserTest::Observe( 657 void ExtensionBrowserTest::Observe(
658 int type, 658 int type,
659 const content::NotificationSource& source, 659 const content::NotificationSource& source,
660 const content::NotificationDetails& details) { 660 const content::NotificationDetails& details) {
661 switch (type) { 661 switch (type) {
662 case chrome::NOTIFICATION_EXTENSION_LOADED: 662 case chrome::NOTIFICATION_EXTENSION_LOADED:
663 last_loaded_extension_id_ = 663 last_loaded_extension_id_ =
664 content::Details<const Extension>(details).ptr()->id(); 664 content::Details<const Extension>(details).ptr()->id();
665 VLOG(1) << "Got EXTENSION_LOADED notification."; 665 VLOG(1) << "Got EXTENSION_LOADED notification.";
666 MessageLoopForUI::current()->Quit(); 666 base::MessageLoopForUI::current()->Quit();
667 break; 667 break;
668 668
669 case chrome::NOTIFICATION_CRX_INSTALLER_DONE: 669 case chrome::NOTIFICATION_CRX_INSTALLER_DONE:
670 VLOG(1) << "Got CRX_INSTALLER_DONE notification."; 670 VLOG(1) << "Got CRX_INSTALLER_DONE notification.";
671 { 671 {
672 const Extension* extension = 672 const Extension* extension =
673 content::Details<const Extension>(details).ptr(); 673 content::Details<const Extension>(details).ptr();
674 if (extension) 674 if (extension)
675 last_loaded_extension_id_ = extension->id(); 675 last_loaded_extension_id_ = extension->id();
676 else 676 else
677 last_loaded_extension_id_ = ""; 677 last_loaded_extension_id_ = "";
678 } 678 }
679 ++crx_installers_done_observed_; 679 ++crx_installers_done_observed_;
680 MessageLoopForUI::current()->Quit(); 680 base::MessageLoopForUI::current()->Quit();
681 break; 681 break;
682 682
683 case chrome::NOTIFICATION_EXTENSION_INSTALLED: 683 case chrome::NOTIFICATION_EXTENSION_INSTALLED:
684 VLOG(1) << "Got EXTENSION_INSTALLED notification."; 684 VLOG(1) << "Got EXTENSION_INSTALLED notification.";
685 ++extension_installs_observed_; 685 ++extension_installs_observed_;
686 MessageLoopForUI::current()->Quit(); 686 base::MessageLoopForUI::current()->Quit();
687 break; 687 break;
688 688
689 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: 689 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR:
690 VLOG(1) << "Got EXTENSION_INSTALL_ERROR notification."; 690 VLOG(1) << "Got EXTENSION_INSTALL_ERROR notification.";
691 MessageLoopForUI::current()->Quit(); 691 base::MessageLoopForUI::current()->Quit();
692 break; 692 break;
693 693
694 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: 694 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED:
695 VLOG(1) << "Got EXTENSION_PROCESS_TERMINATED notification."; 695 VLOG(1) << "Got EXTENSION_PROCESS_TERMINATED notification.";
696 MessageLoopForUI::current()->Quit(); 696 base::MessageLoopForUI::current()->Quit();
697 break; 697 break;
698 698
699 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: 699 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR:
700 VLOG(1) << "Got EXTENSION_LOAD_ERROR notification."; 700 VLOG(1) << "Got EXTENSION_LOAD_ERROR notification.";
701 ++extension_load_errors_observed_; 701 ++extension_load_errors_observed_;
702 MessageLoopForUI::current()->Quit(); 702 base::MessageLoopForUI::current()->Quit();
703 break; 703 break;
704 704
705 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED: { 705 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED: {
706 LocationBarTesting* location_bar = 706 LocationBarTesting* location_bar =
707 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); 707 browser()->window()->GetLocationBar()->GetLocationBarForTesting();
708 VLOG(1) << "Got EXTENSION_PAGE_ACTION_COUNT_CHANGED notification. Number " 708 VLOG(1) << "Got EXTENSION_PAGE_ACTION_COUNT_CHANGED notification. Number "
709 "of page actions: " << location_bar->PageActionCount(); 709 "of page actions: " << location_bar->PageActionCount();
710 if (location_bar->PageActionCount() == 710 if (location_bar->PageActionCount() ==
711 target_page_action_count_) { 711 target_page_action_count_) {
712 target_page_action_count_ = -1; 712 target_page_action_count_ = -1;
713 MessageLoopForUI::current()->Quit(); 713 base::MessageLoopForUI::current()->Quit();
714 } 714 }
715 break; 715 break;
716 } 716 }
717 717
718 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { 718 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: {
719 LocationBarTesting* location_bar = 719 LocationBarTesting* location_bar =
720 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); 720 browser()->window()->GetLocationBar()->GetLocationBarForTesting();
721 VLOG(1) << "Got EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED notification. " 721 VLOG(1) << "Got EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED notification. "
722 "Number of visible page actions: " 722 "Number of visible page actions: "
723 << location_bar->PageActionVisibleCount(); 723 << location_bar->PageActionVisibleCount();
724 if (location_bar->PageActionVisibleCount() == 724 if (location_bar->PageActionVisibleCount() ==
725 target_visible_page_action_count_) { 725 target_visible_page_action_count_) {
726 target_visible_page_action_count_ = -1; 726 target_visible_page_action_count_ = -1;
727 MessageLoopForUI::current()->Quit(); 727 base::MessageLoopForUI::current()->Quit();
728 } 728 }
729 break; 729 break;
730 } 730 }
731 731
732 case content::NOTIFICATION_LOAD_STOP: 732 case content::NOTIFICATION_LOAD_STOP:
733 VLOG(1) << "Got LOAD_STOP notification."; 733 VLOG(1) << "Got LOAD_STOP notification.";
734 MessageLoopForUI::current()->Quit(); 734 base::MessageLoopForUI::current()->Quit();
735 break; 735 break;
736 736
737 default: 737 default:
738 NOTREACHED(); 738 NOTREACHED();
739 break; 739 break;
740 } 740 }
741 } 741 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_apitest.cc ('k') | chrome/browser/extensions/extension_crash_recovery_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698