OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/user_prefs/tracked/segregated_pref_store.h" | 5 #include "services/preferences/tracked/segregated_pref_store.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "components/prefs/persistent_pref_store.h" | 17 #include "components/prefs/persistent_pref_store.h" |
18 #include "components/prefs/pref_store_observer_mock.h" | 18 #include "components/prefs/pref_store_observer_mock.h" |
19 #include "components/prefs/testing_pref_store.h" | 19 #include "components/prefs/testing_pref_store.h" |
20 #include "components/user_prefs/tracked/segregated_pref_store.h" | |
21 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
25 const char kSelectedPref[] = "selected_pref"; | 24 const char kSelectedPref[] = "selected_pref"; |
26 const char kUnselectedPref[] = "unselected_pref"; | 25 const char kUnselectedPref[] = "unselected_pref"; |
27 const char kSharedPref[] = "shared_pref"; | 26 const char kSharedPref[] = "shared_pref"; |
28 | 27 |
29 const char kValue1[] = "value1"; | 28 const char kValue1[] = "value1"; |
30 const char kValue2[] = "value2"; | 29 const char kValue2[] = "value2"; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 EXPECT_TRUE(base::Value(kValue1).Equals(value)); | 295 EXPECT_TRUE(base::Value(kValue1).Equals(value)); |
297 | 296 |
298 // Check that a a default preference is returned. | 297 // Check that a a default preference is returned. |
299 ASSERT_TRUE(values->Get(kUnselectedPref, &value)); | 298 ASSERT_TRUE(values->Get(kUnselectedPref, &value)); |
300 EXPECT_TRUE(base::Value(kValue2).Equals(value)); | 299 EXPECT_TRUE(base::Value(kValue2).Equals(value)); |
301 | 300 |
302 // Check that the selected preference is preferred. | 301 // Check that the selected preference is preferred. |
303 ASSERT_TRUE(values->Get(kSharedPref, &value)); | 302 ASSERT_TRUE(values->Get(kSharedPref, &value)); |
304 EXPECT_TRUE(base::Value(kValue1).Equals(value)); | 303 EXPECT_TRUE(base::Value(kValue1).Equals(value)); |
305 } | 304 } |
OLD | NEW |