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

Unified Diff: chrome/tools/test/image_diff/image_diff.cc

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/unit/chrome_test_suite.h ('k') | chrome/views/window.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/tools/test/image_diff/image_diff.cc
diff --git a/chrome/tools/test/image_diff/image_diff.cc b/chrome/tools/test/image_diff/image_diff.cc
index c21003d754b8e2b4365717b0687548a9dad18f63..044b89cba9cc1f64971bb8aeb78696c72c4639e5 100644
--- a/chrome/tools/test/image_diff/image_diff.cc
+++ b/chrome/tools/test/image_diff/image_diff.cc
@@ -320,13 +320,8 @@ int DiffImages(const char* file1, const char* file2, const char* out_file) {
int main(int argc, const char* argv[]) {
base::EnableTerminationOnHeapCorruption();
- // TODO(estade): why does using the default constructor (command line
- // singleton) cause an exception when run in debug mode?
-#if defined(OS_WIN)
- CommandLine parsed_command_line(::GetCommandLine());
-#elif defined(OS_POSIX)
- CommandLine parsed_command_line(argc, argv);
-#endif
+ CommandLine::Init(argc, argv);
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
if (parsed_command_line.HasSwitch(kOptionPollStdin)) {
// Watch stdin for filenames.
std::string stdin_buffer;
@@ -353,15 +348,14 @@ int main(int argc, const char* argv[]) {
return 0;
}
+ std::vector<std::wstring> values = parsed_command_line.GetLooseValues();
if (parsed_command_line.HasSwitch(kOptionGenerateDiff)) {
- if (3 == parsed_command_line.GetLooseValueCount()) {
- CommandLine::LooseValueIterator iter =
- parsed_command_line.GetLooseValuesBegin();
- return DiffImages(WideToUTF8(*iter).c_str(),
- WideToUTF8(*(iter + 1)).c_str(),
- WideToUTF8(*(iter + 2)).c_str());
+ if (values.size() == 3) {
+ return DiffImages(WideToUTF8(values[0]).c_str(),
+ WideToUTF8(values[1]).c_str(),
+ WideToUTF8(values[2]).c_str());
}
- } else if (2 == parsed_command_line.GetLooseValueCount()) {
+ } else if (values.size() == 2) {
return CompareImages(argv[1], argv[2]);
}
« no previous file with comments | « chrome/test/unit/chrome_test_suite.h ('k') | chrome/views/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698