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 | |
45 private: | 42 private: |
46 ScopedTempDir temp_dir_; | 43 ScopedTempDir temp_dir_; |
47 MessageLoop file_message_loop_; | 44 MessageLoop file_message_loop_; |
48 DISALLOW_COPY_AND_ASSIGN(CredentialCacheServiceTest); | 45 DISALLOW_COPY_AND_ASSIGN(CredentialCacheServiceTest); |
49 }; | 46 }; |
50 | 47 |
51 TEST_F(CredentialCacheServiceTest, TestPackAndUnpack) { | 48 TEST_F(CredentialCacheServiceTest, TestPackAndUnpack) { |
52 // Pack a sample credential string. | 49 // Pack a sample credential string. |
53 std::string original = "sample_credential"; | 50 std::string original = "sample_credential"; |
54 scoped_ptr<base::StringValue> packed( | 51 scoped_ptr<base::StringValue> packed( |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 124 |
128 // Try to write a boolean pref with value true, and make sure an the default | 125 // Try to write a boolean pref with value true, and make sure an the default |
129 // value of false is written in its place. | 126 // value of false is written in its place. |
130 UpdateBooleanPref(prefs::kSyncKeepEverythingSynced, sync_everything); | 127 UpdateBooleanPref(prefs::kSyncKeepEverythingSynced, sync_everything); |
131 ASSERT_TRUE(HasPref(local_store(), prefs::kSyncKeepEverythingSynced)); | 128 ASSERT_TRUE(HasPref(local_store(), prefs::kSyncKeepEverythingSynced)); |
132 ASSERT_TRUE(false == GetBooleanPref(local_store(), | 129 ASSERT_TRUE(false == GetBooleanPref(local_store(), |
133 prefs::kSyncKeepEverythingSynced)); | 130 prefs::kSyncKeepEverythingSynced)); |
134 } | 131 } |
135 | 132 |
136 } // namespace syncer | 133 } // namespace syncer |
OLD | NEW |