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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 set_local_store(new JsonPrefStore( | 32 set_local_store(new JsonPrefStore( |
33 temp_dir_.path().Append(chrome::kSyncCredentialsFilename), | 33 temp_dir_.path().Append(chrome::kSyncCredentialsFilename), |
34 file_message_loop_.message_loop_proxy())); | 34 file_message_loop_.message_loop_proxy())); |
35 } | 35 } |
36 | 36 |
37 // testing::Test implementation. | 37 // testing::Test implementation. |
38 virtual void TearDown() OVERRIDE { | 38 virtual void TearDown() OVERRIDE { |
39 file_message_loop_.RunAllPending(); | 39 file_message_loop_.RunAllPending(); |
40 } | 40 } |
41 | 41 |
| 42 // PrefStore::Observer implementation. |
| 43 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE {} |
| 44 |
42 private: | 45 private: |
43 ScopedTempDir temp_dir_; | 46 ScopedTempDir temp_dir_; |
44 MessageLoop file_message_loop_; | 47 MessageLoop file_message_loop_; |
45 DISALLOW_COPY_AND_ASSIGN(CredentialCacheServiceTest); | 48 DISALLOW_COPY_AND_ASSIGN(CredentialCacheServiceTest); |
46 }; | 49 }; |
47 | 50 |
48 TEST_F(CredentialCacheServiceTest, TestPackAndUnpack) { | 51 TEST_F(CredentialCacheServiceTest, TestPackAndUnpack) { |
49 // Pack a sample credential string. | 52 // Pack a sample credential string. |
50 std::string original = "sample_credential"; | 53 std::string original = "sample_credential"; |
51 scoped_ptr<base::StringValue> packed( | 54 scoped_ptr<base::StringValue> packed( |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 127 |
125 // Try to write a boolean pref with value true, and make sure an the default | 128 // Try to write a boolean pref with value true, and make sure an the default |
126 // value of false is written in its place. | 129 // value of false is written in its place. |
127 UpdateBooleanPref(prefs::kSyncKeepEverythingSynced, sync_everything); | 130 UpdateBooleanPref(prefs::kSyncKeepEverythingSynced, sync_everything); |
128 ASSERT_TRUE(HasPref(local_store(), prefs::kSyncKeepEverythingSynced)); | 131 ASSERT_TRUE(HasPref(local_store(), prefs::kSyncKeepEverythingSynced)); |
129 ASSERT_TRUE(false == GetBooleanPref(local_store(), | 132 ASSERT_TRUE(false == GetBooleanPref(local_store(), |
130 prefs::kSyncKeepEverythingSynced)); | 133 prefs::kSyncKeepEverythingSynced)); |
131 } | 134 } |
132 | 135 |
133 } // namespace syncer | 136 } // namespace syncer |
OLD | NEW |