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 "extension_prefs_unittest.h" | 5 #include "extension_prefs_unittest.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/extensions/extension_prefs.h" | 13 #include "chrome/browser/extensions/extension_prefs.h" |
14 #include "chrome/browser/extensions/extension_pref_value_map.h" | 14 #include "chrome/browser/extensions/extension_pref_value_map.h" |
15 #include "chrome/browser/prefs/pref_change_registrar.h" | 15 #include "chrome/browser/prefs/pref_change_registrar.h" |
16 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 16 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/extensions/extension_manifest_constants.h" | 18 #include "chrome/common/extensions/extension_manifest_constants.h" |
19 #include "chrome/common/extensions/extension_permission_set.h" | 19 #include "chrome/common/extensions/extension_permission_set.h" |
20 #include "chrome/common/string_ordinal.h" | 20 #include "chrome/common/string_ordinal.h" |
21 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
23 #include "content/test/notification_observer_mock.h" | 23 #include "content/test/notification_observer_mock.h" |
24 | 24 |
25 using base::Time; | 25 using base::Time; |
26 using base::TimeDelta; | 26 using base::TimeDelta; |
27 using content::BrowserThread; | 27 using content::BrowserThread; |
| 28 using extensions::Extension; |
| 29 using extensions::ExtensionList; |
28 | 30 |
29 namespace { | 31 namespace { |
30 | 32 |
31 const char kPref1[] = "path1.subpath"; | 33 const char kPref1[] = "path1.subpath"; |
32 const char kPref2[] = "path2"; | 34 const char kPref2[] = "path2"; |
33 const char kPref3[] = "path3"; | 35 const char kPref3[] = "path3"; |
34 const char kPref4[] = "path4"; | 36 const char kPref4[] = "path4"; |
35 | 37 |
36 // Default values in case an extension pref value is not overridden. | 38 // Default values in case an extension pref value is not overridden. |
37 const char kDefaultPref1[] = "default pref 1"; | 39 const char kDefaultPref1[] = "default pref 1"; |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 EXPECT_FALSE(prefs()->IsExtensionBlacklisted((*iter)->id())); | 442 EXPECT_FALSE(prefs()->IsExtensionBlacklisted((*iter)->id())); |
441 } | 443 } |
442 | 444 |
443 // Make sure GetInstalledExtensionsInfo returns only the non-blacklisted | 445 // Make sure GetInstalledExtensionsInfo returns only the non-blacklisted |
444 // extensions data. | 446 // extensions data. |
445 scoped_ptr<ExtensionPrefs::ExtensionsInfo> info( | 447 scoped_ptr<ExtensionPrefs::ExtensionsInfo> info( |
446 prefs()->GetInstalledExtensionsInfo()); | 448 prefs()->GetInstalledExtensionsInfo()); |
447 EXPECT_EQ(4u, info->size()); | 449 EXPECT_EQ(4u, info->size()); |
448 ExtensionPrefs::ExtensionsInfo::iterator info_iter; | 450 ExtensionPrefs::ExtensionsInfo::iterator info_iter; |
449 for (info_iter = info->begin(); info_iter != info->end(); ++info_iter) { | 451 for (info_iter = info->begin(); info_iter != info->end(); ++info_iter) { |
450 ExtensionInfo* extension_info = info_iter->get(); | 452 extensions::ExtensionInfo* extension_info = info_iter->get(); |
451 EXPECT_NE(extensions_[0]->id(), extension_info->extension_id); | 453 EXPECT_NE(extensions_[0]->id(), extension_info->extension_id); |
452 } | 454 } |
453 } | 455 } |
454 | 456 |
455 private: | 457 private: |
456 ExtensionList extensions_; | 458 ExtensionList extensions_; |
457 | 459 |
458 // An id we'll make up that doesn't match any installed extension id. | 460 // An id we'll make up that doesn't match any installed extension id. |
459 std::string not_installed_id_; | 461 std::string not_installed_id_; |
460 }; | 462 }; |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 ++iteration_; | 1133 ++iteration_; |
1132 } else { | 1134 } else { |
1133 EXPECT_EQ(kDefaultPref1, actual); | 1135 EXPECT_EQ(kDefaultPref1, actual); |
1134 } | 1136 } |
1135 } | 1137 } |
1136 | 1138 |
1137 private: | 1139 private: |
1138 int iteration_; | 1140 int iteration_; |
1139 }; | 1141 }; |
1140 TEST_F(ExtensionPrefsDisableExtensions, ExtensionPrefsDisableExtensions) {} | 1142 TEST_F(ExtensionPrefsDisableExtensions, ExtensionPrefsDisableExtensions) {} |
OLD | NEW |