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