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/string_number_conversions.h" | 5 #include "base/string_number_conversions.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/about_flags.h" | 8 #include "chrome/browser/about_flags.h" |
| 9 #include "chrome/browser/prefs/pref_registry_simple.h" |
9 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
11 #include "chrome/test/base/testing_pref_service.h" | 12 #include "chrome/test/base/testing_pref_service.h" |
12 #include "grit/chromium_strings.h" | 13 #include "grit/chromium_strings.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 const char kFlags1[] = "flag1"; | 16 const char kFlags1[] = "flag1"; |
16 const char kFlags2[] = "flag2"; | 17 const char kFlags2[] = "flag2"; |
17 const char kFlags3[] = "flag3"; | 18 const char kFlags3[] = "flag3"; |
18 const char kFlags4[] = "flag4"; | 19 const char kFlags4[] = "flag4"; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 "", | 80 "", |
80 "", | 81 "", |
81 kMultiChoices, | 82 kMultiChoices, |
82 arraysize(kMultiChoices) | 83 arraysize(kMultiChoices) |
83 }, | 84 }, |
84 }; | 85 }; |
85 | 86 |
86 class AboutFlagsTest : public ::testing::Test { | 87 class AboutFlagsTest : public ::testing::Test { |
87 protected: | 88 protected: |
88 AboutFlagsTest() { | 89 AboutFlagsTest() { |
89 prefs_.RegisterListPref(prefs::kEnabledLabsExperiments); | 90 prefs_.registry()->RegisterListPref(prefs::kEnabledLabsExperiments); |
90 testing::ClearState(); | 91 testing::ClearState(); |
91 } | 92 } |
92 | 93 |
93 virtual void SetUp() { | 94 virtual void SetUp() { |
94 for (size_t i = 0; i < arraysize(kExperiments); ++i) | 95 for (size_t i = 0; i < arraysize(kExperiments); ++i) |
95 kExperiments[i].supported_platforms = GetCurrentPlatform(); | 96 kExperiments[i].supported_platforms = GetCurrentPlatform(); |
96 | 97 |
97 int os_other_than_current = 1; | 98 int os_other_than_current = 1; |
98 while (os_other_than_current == GetCurrentPlatform()) | 99 while (os_other_than_current == GetCurrentPlatform()) |
99 os_other_than_current <<= 1; | 100 os_other_than_current <<= 1; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 testing::SetExperiments(NULL, 0); | 317 testing::SetExperiments(NULL, 0); |
317 size_t count; | 318 size_t count; |
318 const Experiment* experiments = testing::GetExperiments(&count); | 319 const Experiment* experiments = testing::GetExperiments(&count); |
319 for (size_t i = 0; i < count; ++i) { | 320 for (size_t i = 0; i < count; ++i) { |
320 std::string name = experiments->internal_name; | 321 std::string name = experiments->internal_name; |
321 EXPECT_EQ(std::string::npos, name.find(testing::kMultiSeparator)) << i; | 322 EXPECT_EQ(std::string::npos, name.find(testing::kMultiSeparator)) << i; |
322 } | 323 } |
323 } | 324 } |
324 | 325 |
325 } // namespace about_flags | 326 } // namespace about_flags |
OLD | NEW |