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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/prefs/pref_store_observer_mock.h" | 8 #include "base/prefs/pref_store_observer_mock.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/extension_pref_value_map.h" | 10 #include "chrome/browser/extensions/extension_pref_value_map.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 static const extensions::ExtensionPrefsScope kRegularOnly = | 38 static const extensions::ExtensionPrefsScope kRegularOnly = |
39 extensions::kExtensionPrefsScopeRegularOnly; | 39 extensions::kExtensionPrefsScopeRegularOnly; |
40 static const extensions::ExtensionPrefsScope kIncognitoPersistent = | 40 static const extensions::ExtensionPrefsScope kIncognitoPersistent = |
41 extensions::kExtensionPrefsScopeIncognitoPersistent; | 41 extensions::kExtensionPrefsScopeIncognitoPersistent; |
42 static const extensions::ExtensionPrefsScope kIncognitoSessionOnly = | 42 static const extensions::ExtensionPrefsScope kIncognitoSessionOnly = |
43 extensions::kExtensionPrefsScopeIncognitoSessionOnly; | 43 extensions::kExtensionPrefsScopeIncognitoSessionOnly; |
44 | 44 |
45 // Returns an empty string if the key is not set. | 45 // Returns an empty string if the key is not set. |
46 std::string GetValue(const char * key, bool incognito) const { | 46 std::string GetValue(const char * key, bool incognito) const { |
47 const Value *value = epvm_.GetEffectivePrefValue(key, incognito, NULL); | 47 const Value *value = epvm_.GetEffectivePrefValue(key, incognito, NULL); |
48 std::string string_value = ""; | 48 std::string string_value; |
49 if (value) | 49 if (value) |
50 value->GetAsString(&string_value); | 50 value->GetAsString(&string_value); |
51 return string_value; | 51 return string_value; |
52 } | 52 } |
53 | 53 |
54 protected: | 54 protected: |
55 ExtensionPrefValueMap epvm_; | 55 ExtensionPrefValueMap epvm_; |
56 }; | 56 }; |
57 | 57 |
58 class ExtensionPrefValueMapTest | 58 class ExtensionPrefValueMapTest |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 OverrideIncognitoTestCase(1, 0, 0, 0, 5, 0, 0, 0, 5, 5), | 391 OverrideIncognitoTestCase(1, 0, 0, 0, 5, 0, 0, 0, 5, 5), |
392 OverrideIncognitoTestCase(1, 2, 3, 0, 5, 0, 0, 0, 5, 5), | 392 OverrideIncognitoTestCase(1, 2, 3, 0, 5, 0, 0, 0, 5, 5), |
393 OverrideIncognitoTestCase(1, 0, 0, 0, 0, 6, 0, 0, 6, 1), | 393 OverrideIncognitoTestCase(1, 0, 0, 0, 0, 6, 0, 0, 6, 1), |
394 OverrideIncognitoTestCase(1, 0, 3, 0, 5, 6, 0, 0, 6, 5), | 394 OverrideIncognitoTestCase(1, 0, 3, 0, 5, 6, 0, 0, 6, 5), |
395 OverrideIncognitoTestCase(1, 0, 0, 4, 5, 6, 0, 0, 6, 5), | 395 OverrideIncognitoTestCase(1, 0, 0, 4, 5, 6, 0, 0, 6, 5), |
396 OverrideIncognitoTestCase(1, 0, 0, 0, 0, 0, 7, 0, 1, 7), | 396 OverrideIncognitoTestCase(1, 0, 0, 0, 0, 0, 7, 0, 1, 7), |
397 OverrideIncognitoTestCase(1, 2, 0, 0, 5, 0, 7, 0, 5, 7), | 397 OverrideIncognitoTestCase(1, 2, 0, 0, 5, 0, 7, 0, 5, 7), |
398 OverrideIncognitoTestCase(1, 2, 0, 0, 5, 0, 0, 8, 5, 8), | 398 OverrideIncognitoTestCase(1, 2, 0, 0, 5, 0, 0, 8, 5, 8), |
399 OverrideIncognitoTestCase(1, 2, 0, 0, 5, 0, 7, 8, 5, 8), | 399 OverrideIncognitoTestCase(1, 2, 0, 0, 5, 0, 7, 8, 5, 8), |
400 OverrideIncognitoTestCase(1, 2, 3, 0, 0, 6, 7, 0, 6, 7))); | 400 OverrideIncognitoTestCase(1, 2, 3, 0, 0, 6, 7, 0, 6, 7))); |
OLD | NEW |