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

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

Issue 398083002: Add "UninstallReason" parameter to ExtensionRegistryObserver::OnExtensionUninstalled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix header file. Created 6 years, 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/dev_mode_bubble_controller.h" 10 #include "chrome/browser/extensions/dev_mode_bubble_controller.h"
11 #include "chrome/browser/extensions/extension_function_test_utils.h" 11 #include "chrome/browser/extensions/extension_function_test_utils.h"
12 #include "chrome/browser/extensions/extension_message_bubble.h" 12 #include "chrome/browser/extensions/extension_message_bubble.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/ntp_overridden_bubble_controller.h" 14 #include "chrome/browser/extensions/ntp_overridden_bubble_controller.h"
15 #include "chrome/browser/extensions/proxy_overridden_bubble_controller.h" 15 #include "chrome/browser/extensions/proxy_overridden_bubble_controller.h"
16 #include "chrome/browser/extensions/settings_api_bubble_controller.h" 16 #include "chrome/browser/extensions/settings_api_bubble_controller.h"
17 #include "chrome/browser/extensions/suspicious_extension_bubble_controller.h" 17 #include "chrome/browser/extensions/suspicious_extension_bubble_controller.h"
18 #include "chrome/browser/extensions/test_extension_system.h" 18 #include "chrome/browser/extensions/test_extension_system.h"
19 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "chrome/test/base/testing_profile.h" 21 #include "chrome/test/base/testing_profile.h"
22 #include "content/public/test/test_browser_thread_bundle.h" 22 #include "content/public/test/test_browser_thread_bundle.h"
23 #include "extensions/browser/extension_pref_value_map.h" 23 #include "extensions/browser/extension_pref_value_map.h"
24 #include "extensions/browser/extension_pref_value_map_factory.h" 24 #include "extensions/browser/extension_pref_value_map_factory.h"
25 #include "extensions/browser/extension_prefs.h" 25 #include "extensions/browser/extension_prefs.h"
26 #include "extensions/browser/extension_registry.h" 26 #include "extensions/browser/extension_registry.h"
27 #include "extensions/browser/extension_system.h" 27 #include "extensions/browser/extension_system.h"
28 #include "extensions/browser/uninstall_reason.h"
28 #include "extensions/common/extension.h" 29 #include "extensions/common/extension.h"
29 #include "extensions/common/extension_builder.h" 30 #include "extensions/common/extension_builder.h"
30 #include "extensions/common/feature_switch.h" 31 #include "extensions/common/feature_switch.h"
31 #include "extensions/common/value_builder.h" 32 #include "extensions/common/value_builder.h"
32 33
33 namespace { 34 namespace {
34 35
35 const char kId1[] = "iccfkkhkfiphcjdakkmcjmkfboccmndk"; 36 const char kId1[] = "iccfkkhkfiphcjdakkmcjmkfboccmndk";
36 const char kId2[] = "ajjhifimiemdpmophmkkkcijegphclbl"; 37 const char kId2[] = "ajjhifimiemdpmophmkkkcijegphclbl";
37 const char kId3[] = "ioibbbfddncmmabjmpokikkeiofalaek"; 38 const char kId3[] = "ioibbbfddncmmabjmpokikkeiofalaek";
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL); 715 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL);
715 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId2) != NULL); 716 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId2) != NULL);
716 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId3) != NULL); 717 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId3) != NULL);
717 // No extension should have been acknowledged (it got disabled). 718 // No extension should have been acknowledged (it got disabled).
718 EXPECT_FALSE(prefs->HasSettingsApiBubbleBeenAcknowledged(kId1)); 719 EXPECT_FALSE(prefs->HasSettingsApiBubbleBeenAcknowledged(kId1));
719 EXPECT_FALSE(prefs->HasSettingsApiBubbleBeenAcknowledged(kId2)); 720 EXPECT_FALSE(prefs->HasSettingsApiBubbleBeenAcknowledged(kId2));
720 EXPECT_FALSE(prefs->HasSettingsApiBubbleBeenAcknowledged(kId3)); 721 EXPECT_FALSE(prefs->HasSettingsApiBubbleBeenAcknowledged(kId3));
721 722
722 // Clean up after ourselves. 723 // Clean up after ourselves.
723 service_->UninstallExtension( 724 service_->UninstallExtension(
724 kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); 725 kId1, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
725 service_->UninstallExtension( 726 service_->UninstallExtension(
726 kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); 727 kId2, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
727 service_->UninstallExtension( 728 service_->UninstallExtension(
728 kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); 729 kId3, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
729 } 730 }
730 } 731 }
731 732
732 // The feature this is meant to test is only implemented on Windows. 733 // The feature this is meant to test is only implemented on Windows.
733 #if defined(OS_WIN) 734 #if defined(OS_WIN)
734 #define MAYBE_NtpOverriddenControllerTest NtpOverriddenControllerTest 735 #define MAYBE_NtpOverriddenControllerTest NtpOverriddenControllerTest
735 #else 736 #else
736 #define MAYBE_NtpOverriddenControllerTest DISABLED_NtpOverriddenControllerTest 737 #define MAYBE_NtpOverriddenControllerTest DISABLED_NtpOverriddenControllerTest
737 #endif 738 #endif
738 739
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL); 817 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL);
817 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId2) != NULL); 818 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId2) != NULL);
818 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId3) != NULL); 819 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId3) != NULL);
819 // No extension should have been acknowledged (it got disabled). 820 // No extension should have been acknowledged (it got disabled).
820 EXPECT_FALSE(prefs->HasNtpOverriddenBubbleBeenAcknowledged(kId1)); 821 EXPECT_FALSE(prefs->HasNtpOverriddenBubbleBeenAcknowledged(kId1));
821 EXPECT_FALSE(prefs->HasNtpOverriddenBubbleBeenAcknowledged(kId2)); 822 EXPECT_FALSE(prefs->HasNtpOverriddenBubbleBeenAcknowledged(kId2));
822 EXPECT_FALSE(prefs->HasNtpOverriddenBubbleBeenAcknowledged(kId3)); 823 EXPECT_FALSE(prefs->HasNtpOverriddenBubbleBeenAcknowledged(kId3));
823 824
824 // Clean up after ourselves. 825 // Clean up after ourselves.
825 service_->UninstallExtension( 826 service_->UninstallExtension(
826 kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); 827 kId1, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
827 service_->UninstallExtension( 828 service_->UninstallExtension(
828 kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); 829 kId2, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
829 service_->UninstallExtension( 830 service_->UninstallExtension(
830 kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); 831 kId3, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
831 } 832 }
832 833
833 void SetInstallTime(const std::string& extension_id, 834 void SetInstallTime(const std::string& extension_id,
834 const base::Time& time, 835 const base::Time& time,
835 ExtensionPrefs* prefs) { 836 ExtensionPrefs* prefs) {
836 std::string time_str = base::Int64ToString(time.ToInternalValue()); 837 std::string time_str = base::Int64ToString(time.ToInternalValue());
837 prefs->UpdateExtensionPref(extension_id, 838 prefs->UpdateExtensionPref(extension_id,
838 "install_time", 839 "install_time",
839 new base::StringValue(time_str)); 840 new base::StringValue(time_str));
840 } 841 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL); 940 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL);
940 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId2) != NULL); 941 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId2) != NULL);
941 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId3) != NULL); 942 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId3) != NULL);
942 // No extension should have been acknowledged (it got disabled). 943 // No extension should have been acknowledged (it got disabled).
943 EXPECT_FALSE(prefs->HasProxyOverriddenBubbleBeenAcknowledged(kId1)); 944 EXPECT_FALSE(prefs->HasProxyOverriddenBubbleBeenAcknowledged(kId1));
944 EXPECT_FALSE(prefs->HasProxyOverriddenBubbleBeenAcknowledged(kId2)); 945 EXPECT_FALSE(prefs->HasProxyOverriddenBubbleBeenAcknowledged(kId2));
945 EXPECT_FALSE(prefs->HasProxyOverriddenBubbleBeenAcknowledged(kId3)); 946 EXPECT_FALSE(prefs->HasProxyOverriddenBubbleBeenAcknowledged(kId3));
946 947
947 // Clean up after ourselves. 948 // Clean up after ourselves.
948 service_->UninstallExtension( 949 service_->UninstallExtension(
949 kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); 950 kId1, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
950 service_->UninstallExtension( 951 service_->UninstallExtension(
951 kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); 952 kId2, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
952 service_->UninstallExtension( 953 service_->UninstallExtension(
953 kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); 954 kId3, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
954 } 955 }
955 956
956 } // namespace extensions 957 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_gcm_app_handler_unittest.cc ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698