OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 5 #include "base/file_util.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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 EXPECT_TRUE(actual->GetAsString(&path)); | 118 EXPECT_TRUE(actual->GetAsString(&path)); |
119 EXPECT_EQ(some_path.value(), path); | 119 EXPECT_EQ(some_path.value(), path); |
120 | 120 |
121 // Test reading some other data types from sub-dictionaries. | 121 // Test reading some other data types from sub-dictionaries. |
122 EXPECT_EQ(PrefStore::READ_OK, | 122 EXPECT_EQ(PrefStore::READ_OK, |
123 pref_store->GetValue(kNewWindowsInTabs, &actual)); | 123 pref_store->GetValue(kNewWindowsInTabs, &actual)); |
124 bool boolean = false; | 124 bool boolean = false; |
125 EXPECT_TRUE(actual->GetAsBoolean(&boolean)); | 125 EXPECT_TRUE(actual->GetAsBoolean(&boolean)); |
126 EXPECT_TRUE(boolean); | 126 EXPECT_TRUE(boolean); |
127 | 127 |
128 pref_store->SetValue(kNewWindowsInTabs, | 128 pref_store->SetValue(kNewWindowsInTabs, base::FalseValue()); |
129 Value::CreateBooleanValue(false)); | |
130 EXPECT_EQ(PrefStore::READ_OK, | 129 EXPECT_EQ(PrefStore::READ_OK, |
131 pref_store->GetValue(kNewWindowsInTabs, &actual)); | 130 pref_store->GetValue(kNewWindowsInTabs, &actual)); |
132 EXPECT_TRUE(actual->GetAsBoolean(&boolean)); | 131 EXPECT_TRUE(actual->GetAsBoolean(&boolean)); |
133 EXPECT_FALSE(boolean); | 132 EXPECT_FALSE(boolean); |
134 | 133 |
135 EXPECT_EQ(PrefStore::READ_OK, pref_store->GetValue(kMaxTabs, &actual)); | 134 EXPECT_EQ(PrefStore::READ_OK, pref_store->GetValue(kMaxTabs, &actual)); |
136 int integer = 0; | 135 int integer = 0; |
137 EXPECT_TRUE(actual->GetAsInteger(&integer)); | 136 EXPECT_TRUE(actual->GetAsInteger(&integer)); |
138 EXPECT_EQ(20, integer); | 137 EXPECT_EQ(20, integer); |
139 pref_store->SetValue(kMaxTabs, Value::CreateIntegerValue(10)); | 138 pref_store->SetValue(kMaxTabs, Value::CreateIntegerValue(10)); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 pref_store->ReadPrefsAsync(mock_error_delegate); | 236 pref_store->ReadPrefsAsync(mock_error_delegate); |
238 | 237 |
239 EXPECT_CALL(mock_observer, OnInitializationCompleted(true)).Times(1); | 238 EXPECT_CALL(mock_observer, OnInitializationCompleted(true)).Times(1); |
240 EXPECT_CALL(*mock_error_delegate, | 239 EXPECT_CALL(*mock_error_delegate, |
241 OnError(PersistentPrefStore::PREF_READ_ERROR_NO_FILE)).Times(1); | 240 OnError(PersistentPrefStore::PREF_READ_ERROR_NO_FILE)).Times(1); |
242 message_loop_.RunAllPending(); | 241 message_loop_.RunAllPending(); |
243 pref_store->RemoveObserver(&mock_observer); | 242 pref_store->RemoveObserver(&mock_observer); |
244 | 243 |
245 EXPECT_FALSE(pref_store->ReadOnly()); | 244 EXPECT_FALSE(pref_store->ReadOnly()); |
246 } | 245 } |
OLD | NEW |