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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 I10F10, | 68 I10F10, |
69 I10F11, | 69 I10F11, |
70 I11F00, | 70 I11F00, |
71 I11F01, | 71 I11F01, |
72 I11F10, | 72 I11F10, |
73 I11F11, | 73 I11F11, |
74 NUM_INITIAL_AND_FINAL_VALUES, | 74 NUM_INITIAL_AND_FINAL_VALUES, |
75 }; | 75 }; |
76 | 76 |
77 syncer::SyncData CreatePrefSyncData(const std::string& name, bool value) { | 77 syncer::SyncData CreatePrefSyncData(const std::string& name, bool value) { |
78 base::FundamentalValue bool_value(value); | 78 base::Value bool_value(value); |
79 std::string serialized; | 79 std::string serialized; |
80 base::JSONWriter::Write(bool_value, &serialized); | 80 base::JSONWriter::Write(bool_value, &serialized); |
81 sync_pb::EntitySpecifics specifics; | 81 sync_pb::EntitySpecifics specifics; |
82 sync_pb::PreferenceSpecifics* pref = nullptr; | 82 sync_pb::PreferenceSpecifics* pref = nullptr; |
83 if (name == password_manager::prefs::kPasswordManagerSavingEnabled) | 83 if (name == password_manager::prefs::kPasswordManagerSavingEnabled) |
84 pref = specifics.mutable_preference(); | 84 pref = specifics.mutable_preference(); |
85 else if (name == password_manager::prefs::kCredentialsEnableService) | 85 else if (name == password_manager::prefs::kCredentialsEnableService) |
86 pref = specifics.mutable_priority_preference()->mutable_preference(); | 86 pref = specifics.mutable_priority_preference()->mutable_preference(); |
87 else | 87 else |
88 NOTREACHED() << "Wrong preference name: " << name; | 88 NOTREACHED() << "Wrong preference name: " << name; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 ASSERT_EQ(prefs()->GetBoolean(prefs::kCredentialsEnableService), true); | 452 ASSERT_EQ(prefs()->GetBoolean(prefs::kCredentialsEnableService), true); |
453 profile_sync_service()->SetCanSyncStart(false); | 453 profile_sync_service()->SetCanSyncStart(false); |
454 base::HistogramTester tester; | 454 base::HistogramTester tester; |
455 NotifyProfileAdded(); | 455 NotifyProfileAdded(); |
456 ExpectValuesForBothPrefValues(true, true); | 456 ExpectValuesForBothPrefValues(true, true); |
457 EXPECT_THAT(tester.GetAllSamples(kInitialAndFinalValuesHistogramName), | 457 EXPECT_THAT(tester.GetAllSamples(kInitialAndFinalValuesHistogramName), |
458 testing::ElementsAre(base::Bucket(I11F11, 1))); | 458 testing::ElementsAre(base::Bucket(I11F11, 1))); |
459 } | 459 } |
460 | 460 |
461 } // namespace password_manager | 461 } // namespace password_manager |
OLD | NEW |