Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Side by Side Diff: chrome/browser/about_flags_unittest.cc

Issue 2036193002: Allow overriding variation parameter via chrome://flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build deps #2 Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/about_flags.h" 5 #include "chrome/browser/about_flags.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 std::string FilePathStringTypeToString(const base::FilePath::StringType& path) { 162 std::string FilePathStringTypeToString(const base::FilePath::StringType& path) {
163 #if defined(OS_WIN) 163 #if defined(OS_WIN)
164 return base::UTF16ToUTF8(path); 164 return base::UTF16ToUTF8(path);
165 #else 165 #else
166 return path; 166 return path;
167 #endif 167 #endif
168 } 168 }
169 169
170 // Get all associated switches corresponding to defined about_flags.cc entries. 170 // Get all associated switches corresponding to defined about_flags.cc entries.
171 // Does not include information about FEATURE_VALUE entries. 171 // Does not include information about FEATURE_VALUE or
172 // FEATURE_WITH_VARIATIOSN_VALUE entries.
172 std::set<std::string> GetAllSwitchesForTesting() { 173 std::set<std::string> GetAllSwitchesForTesting() {
173 std::set<std::string> result; 174 std::set<std::string> result;
174 175
175 size_t num_entries = 0; 176 size_t num_entries = 0;
176 const flags_ui::FeatureEntry* entries = 177 const flags_ui::FeatureEntry* entries =
177 testing::GetFeatureEntries(&num_entries); 178 testing::GetFeatureEntries(&num_entries);
178 179
179 for (size_t i = 0; i < num_entries; ++i) { 180 for (size_t i = 0; i < num_entries; ++i) {
180 const flags_ui::FeatureEntry& entry = entries[i]; 181 const flags_ui::FeatureEntry& entry = entries[i];
181 switch (entry.type) { 182 switch (entry.type) {
182 case flags_ui::FeatureEntry::SINGLE_VALUE: 183 case flags_ui::FeatureEntry::SINGLE_VALUE:
183 case flags_ui::FeatureEntry::SINGLE_DISABLE_VALUE: 184 case flags_ui::FeatureEntry::SINGLE_DISABLE_VALUE:
184 result.insert(entry.command_line_switch); 185 result.insert(entry.command_line_switch);
185 break; 186 break;
186 case flags_ui::FeatureEntry::MULTI_VALUE: 187 case flags_ui::FeatureEntry::MULTI_VALUE:
187 for (int j = 0; j < entry.num_choices; ++j) { 188 for (int j = 0; j < entry.num_options; ++j) {
188 result.insert(entry.choices[j].command_line_switch); 189 result.insert(entry.ChoiceForOption(j).command_line_switch);
189 } 190 }
190 break; 191 break;
191 case flags_ui::FeatureEntry::ENABLE_DISABLE_VALUE: 192 case flags_ui::FeatureEntry::ENABLE_DISABLE_VALUE:
192 result.insert(entry.command_line_switch); 193 result.insert(entry.command_line_switch);
193 result.insert(entry.disable_command_line_switch); 194 result.insert(entry.disable_command_line_switch);
194 break; 195 break;
195 case flags_ui::FeatureEntry::FEATURE_VALUE: 196 case flags_ui::FeatureEntry::FEATURE_VALUE:
197 case flags_ui::FeatureEntry::FEATURE_WITH_VARIATIONS_VALUE:
196 break; 198 break;
197 } 199 }
198 } 200 }
199 return result; 201 return result;
200 } 202 }
201 203
202 } // anonymous namespace 204 } // anonymous namespace
203 205
204 // Makes sure there are no separators in any of the entry names. 206 // Makes sure there are no separators in any of the entry names.
205 TEST(AboutFlagsTest, NoSeparators) { 207 TEST(AboutFlagsTest, NoSeparators) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 EXPECT_TRUE(enum_entry != histograms_xml_switches_ids.end() && 303 EXPECT_TRUE(enum_entry != histograms_xml_switches_ids.end() &&
302 enum_entry->first == flag) 304 enum_entry->first == flag)
303 << "histograms.xml enum LoginCustomFlags doesn't contain switch '" 305 << "histograms.xml enum LoginCustomFlags doesn't contain switch '"
304 << flag << "' (value=" << uma_id 306 << flag << "' (value=" << uma_id
305 << " expected). Consider adding entry:\n" 307 << " expected). Consider adding entry:\n"
306 << " " << GetHistogramEnumEntryText(flag, uma_id); 308 << " " << GetHistogramEnumEntryText(flag, uma_id);
307 } 309 }
308 } 310 }
309 311
310 } // namespace about_flags 312 } // namespace about_flags
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698