OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/json/json_writer.h" | 5 #include "base/json/json_writer.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "base/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 I10F10, | 69 I10F10, |
70 I10F11, | 70 I10F11, |
71 I11F00, | 71 I11F00, |
72 I11F01, | 72 I11F01, |
73 I11F10, | 73 I11F10, |
74 I11F11, | 74 I11F11, |
75 NUM_INITIAL_AND_FINAL_VALUES, | 75 NUM_INITIAL_AND_FINAL_VALUES, |
76 }; | 76 }; |
77 | 77 |
78 syncer::SyncData CreatePrefSyncData(const std::string& name, bool value) { | 78 syncer::SyncData CreatePrefSyncData(const std::string& name, bool value) { |
79 base::FundamentalValue bool_value(value); | 79 base::Value bool_value(value); |
80 std::string serialized; | 80 std::string serialized; |
81 base::JSONWriter::Write(bool_value, &serialized); | 81 base::JSONWriter::Write(bool_value, &serialized); |
82 sync_pb::EntitySpecifics specifics; | 82 sync_pb::EntitySpecifics specifics; |
83 sync_pb::PreferenceSpecifics* pref = nullptr; | 83 sync_pb::PreferenceSpecifics* pref = nullptr; |
84 if (name == password_manager::prefs::kPasswordManagerSavingEnabled) | 84 if (name == password_manager::prefs::kPasswordManagerSavingEnabled) |
85 pref = specifics.mutable_preference(); | 85 pref = specifics.mutable_preference(); |
86 else if (name == password_manager::prefs::kCredentialsEnableService) | 86 else if (name == password_manager::prefs::kCredentialsEnableService) |
87 pref = specifics.mutable_priority_preference()->mutable_preference(); | 87 pref = specifics.mutable_priority_preference()->mutable_preference(); |
88 else | 88 else |
89 NOTREACHED() << "Wrong preference name: " << name; | 89 NOTREACHED() << "Wrong preference name: " << name; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 ASSERT_EQ(prefs()->GetBoolean(prefs::kCredentialsEnableService), true); | 453 ASSERT_EQ(prefs()->GetBoolean(prefs::kCredentialsEnableService), true); |
454 profile_sync_service()->SetCanSyncStart(false); | 454 profile_sync_service()->SetCanSyncStart(false); |
455 base::HistogramTester tester; | 455 base::HistogramTester tester; |
456 NotifyProfileAdded(); | 456 NotifyProfileAdded(); |
457 ExpectValuesForBothPrefValues(true, true); | 457 ExpectValuesForBothPrefValues(true, true); |
458 EXPECT_THAT(tester.GetAllSamples(kInitialAndFinalValuesHistogramName), | 458 EXPECT_THAT(tester.GetAllSamples(kInitialAndFinalValuesHistogramName), |
459 testing::ElementsAre(base::Bucket(I11F11, 1))); | 459 testing::ElementsAre(base::Bucket(I11F11, 1))); |
460 } | 460 } |
461 | 461 |
462 } // namespace password_manager | 462 } // namespace password_manager |
OLD | NEW |