OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // update here to avoid test failures. | 297 // update here to avoid test failures. |
298 ExtensionPrefValueMap* extension_prefs_value_map = | 298 ExtensionPrefValueMap* extension_prefs_value_map = |
299 ExtensionPrefValueMapFactory::GetForBrowserContext(profile()); | 299 ExtensionPrefValueMapFactory::GetForBrowserContext(profile()); |
300 extension_prefs_value_map->RegisterExtension( | 300 extension_prefs_value_map->RegisterExtension( |
301 id, | 301 id, |
302 base::Time::Now(), | 302 base::Time::Now(), |
303 true, // is_enabled. | 303 true, // is_enabled. |
304 false); // is_incognito_enabled. | 304 false); // is_incognito_enabled. |
305 extension_prefs_value_map->SetExtensionPref(id, proxy_config::prefs::kProxy, | 305 extension_prefs_value_map->SetExtensionPref(id, proxy_config::prefs::kProxy, |
306 kExtensionPrefsScopeRegular, | 306 kExtensionPrefsScopeRegular, |
307 new base::StringValue(id)); | 307 new base::Value(id)); |
308 | 308 |
309 if (ExtensionRegistry::Get(profile())->enabled_extensions().GetByID(id)) | 309 if (ExtensionRegistry::Get(profile())->enabled_extensions().GetByID(id)) |
310 return testing::AssertionSuccess(); | 310 return testing::AssertionSuccess(); |
311 return testing::AssertionFailure() << "Could not install extension: " << id; | 311 return testing::AssertionFailure() << "Could not install extension: " << id; |
312 } | 312 } |
313 | 313 |
314 void Init() { | 314 void Init() { |
315 // The two lines of magical incantation required to get the extension | 315 // The two lines of magical incantation required to get the extension |
316 // service to work inside a unit test and access the extension prefs. | 316 // service to work inside a unit test and access the extension prefs. |
317 static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile())) | 317 static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile())) |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 service_->UninstallExtension(kId3, | 908 service_->UninstallExtension(kId3, |
909 extensions::UNINSTALL_REASON_FOR_TESTING, | 909 extensions::UNINSTALL_REASON_FOR_TESTING, |
910 base::Bind(&base::DoNothing), | 910 base::Bind(&base::DoNothing), |
911 NULL); | 911 NULL); |
912 } | 912 } |
913 | 913 |
914 void SetInstallTime(const std::string& extension_id, | 914 void SetInstallTime(const std::string& extension_id, |
915 const base::Time& time, | 915 const base::Time& time, |
916 ExtensionPrefs* prefs) { | 916 ExtensionPrefs* prefs) { |
917 std::string time_str = base::Int64ToString(time.ToInternalValue()); | 917 std::string time_str = base::Int64ToString(time.ToInternalValue()); |
918 prefs->UpdateExtensionPref(extension_id, | 918 prefs->UpdateExtensionPref(extension_id, "install_time", |
919 "install_time", | 919 new base::Value(time_str)); |
920 new base::StringValue(time_str)); | |
921 } | 920 } |
922 | 921 |
923 // The feature this is meant to test is only implemented on Windows and Mac. | 922 // The feature this is meant to test is only implemented on Windows and Mac. |
924 #if defined(OS_WIN) || defined(OS_MACOSX) | 923 #if defined(OS_WIN) || defined(OS_MACOSX) |
925 // http://crbug.com/397426 | 924 // http://crbug.com/397426 |
926 #define MAYBE_ProxyOverriddenControllerTest DISABLED_ProxyOverriddenControllerTe
st | 925 #define MAYBE_ProxyOverriddenControllerTest DISABLED_ProxyOverriddenControllerTe
st |
927 #else | 926 #else |
928 #define MAYBE_ProxyOverriddenControllerTest DISABLED_ProxyOverriddenControllerTe
st | 927 #define MAYBE_ProxyOverriddenControllerTest DISABLED_ProxyOverriddenControllerTe
st |
929 #endif | 928 #endif |
930 | 929 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 ASSERT_EQ(1u, ntp_bubble_controller->GetExtensionIdList().size()); | 1098 ASSERT_EQ(1u, ntp_bubble_controller->GetExtensionIdList().size()); |
1100 EXPECT_EQ(kId1, ntp_bubble_controller->GetExtensionIdList()[0]); | 1099 EXPECT_EQ(kId1, ntp_bubble_controller->GetExtensionIdList()[0]); |
1101 | 1100 |
1102 // Disable the extension for being from outside the webstore. | 1101 // Disable the extension for being from outside the webstore. |
1103 service_->DisableExtension(kId1, extensions::Extension::DISABLE_NOT_VERIFIED); | 1102 service_->DisableExtension(kId1, extensions::Extension::DISABLE_NOT_VERIFIED); |
1104 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId1)); | 1103 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId1)); |
1105 EXPECT_FALSE(ntp_bubble_controller->ShouldShow()); | 1104 EXPECT_FALSE(ntp_bubble_controller->ShouldShow()); |
1106 } | 1105 } |
1107 | 1106 |
1108 } // namespace extensions | 1107 } // namespace extensions |
OLD | NEW |