| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 }, | 285 }, |
| 286 }; | 286 }; |
| 287 | 287 |
| 288 class AboutFlagsTest : public ::testing::Test { | 288 class AboutFlagsTest : public ::testing::Test { |
| 289 protected: | 289 protected: |
| 290 AboutFlagsTest() : flags_storage_(&prefs_) { | 290 AboutFlagsTest() : flags_storage_(&prefs_) { |
| 291 prefs_.registry()->RegisterListPref(prefs::kEnabledLabsExperiments); | 291 prefs_.registry()->RegisterListPref(prefs::kEnabledLabsExperiments); |
| 292 testing::ClearState(); | 292 testing::ClearState(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 virtual void SetUp() override { | 295 void SetUp() override { |
| 296 for (size_t i = 0; i < arraysize(kExperiments); ++i) | 296 for (size_t i = 0; i < arraysize(kExperiments); ++i) |
| 297 kExperiments[i].supported_platforms = GetCurrentPlatform(); | 297 kExperiments[i].supported_platforms = GetCurrentPlatform(); |
| 298 | 298 |
| 299 int os_other_than_current = 1; | 299 int os_other_than_current = 1; |
| 300 while (os_other_than_current == GetCurrentPlatform()) | 300 while (os_other_than_current == GetCurrentPlatform()) |
| 301 os_other_than_current <<= 1; | 301 os_other_than_current <<= 1; |
| 302 kExperiments[2].supported_platforms = os_other_than_current; | 302 kExperiments[2].supported_platforms = os_other_than_current; |
| 303 | 303 |
| 304 testing::SetExperiments(kExperiments, arraysize(kExperiments)); | 304 testing::SetExperiments(kExperiments, arraysize(kExperiments)); |
| 305 } | 305 } |
| 306 | 306 |
| 307 virtual void TearDown() override { | 307 void TearDown() override { testing::SetExperiments(NULL, 0); } |
| 308 testing::SetExperiments(NULL, 0); | |
| 309 } | |
| 310 | 308 |
| 311 TestingPrefServiceSimple prefs_; | 309 TestingPrefServiceSimple prefs_; |
| 312 PrefServiceFlagsStorage flags_storage_; | 310 PrefServiceFlagsStorage flags_storage_; |
| 313 }; | 311 }; |
| 314 | 312 |
| 315 | 313 |
| 316 TEST_F(AboutFlagsTest, NoChangeNoRestart) { | 314 TEST_F(AboutFlagsTest, NoChangeNoRestart) { |
| 317 EXPECT_FALSE(IsRestartNeededToCommitChanges()); | 315 EXPECT_FALSE(IsRestartNeededToCommitChanges()); |
| 318 SetExperimentEnabled(&flags_storage_, kFlags1, false); | 316 SetExperimentEnabled(&flags_storage_, kFlags1, false); |
| 319 EXPECT_FALSE(IsRestartNeededToCommitChanges()); | 317 EXPECT_FALSE(IsRestartNeededToCommitChanges()); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 EXPECT_TRUE(enum_entry != histograms_xml_switches_ids.end() && | 763 EXPECT_TRUE(enum_entry != histograms_xml_switches_ids.end() && |
| 766 enum_entry->first == *it) | 764 enum_entry->first == *it) |
| 767 << "histograms.xml enum LoginCustomFlags doesn't contain switch '" | 765 << "histograms.xml enum LoginCustomFlags doesn't contain switch '" |
| 768 << *it << "' (value=" << uma_id | 766 << *it << "' (value=" << uma_id |
| 769 << " expected). Consider adding entry:\n" | 767 << " expected). Consider adding entry:\n" |
| 770 << " " << GetHistogramEnumEntryText(*it, uma_id); | 768 << " " << GetHistogramEnumEntryText(*it, uma_id); |
| 771 } | 769 } |
| 772 } | 770 } |
| 773 | 771 |
| 774 } // namespace about_flags | 772 } // namespace about_flags |
| OLD | NEW |