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

Side by Side Diff: base/command_line_unittest.cc

Issue 1273243002: Updates to base unittests so they run correctly in libchrome on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Existing tests using ScopedLocale are wrapped by OS_LINUX, trying that Created 5 years, 4 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 | « no previous file | base/files/dir_reader_posix_unittest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 // Check the optional quoting of placeholders in programs. 371 // Check the optional quoting of placeholders in programs.
372 CommandLine cl_quote_placeholder(FilePath(L"%1")); 372 CommandLine cl_quote_placeholder(FilePath(L"%1"));
373 EXPECT_EQ(L"%1", cl_quote_placeholder.GetCommandLineString()); 373 EXPECT_EQ(L"%1", cl_quote_placeholder.GetCommandLineString());
374 EXPECT_EQ(L"\"%1\"", 374 EXPECT_EQ(L"\"%1\"",
375 cl_quote_placeholder.GetCommandLineStringWithPlaceholders()); 375 cl_quote_placeholder.GetCommandLineStringWithPlaceholders());
376 } 376 }
377 #endif 377 #endif
378 378
379 // Calling Init multiple times should not modify the previous CommandLine. 379 // Calling Init multiple times should not modify the previous CommandLine.
380 TEST(CommandLineTest, Init) { 380 TEST(CommandLineTest, Init) {
381 // Call Init without checking output once so we know it's been called
382 // whether or not the test runner does so.
383 CommandLine::Init(0, NULL);
381 CommandLine* initial = CommandLine::ForCurrentProcess(); 384 CommandLine* initial = CommandLine::ForCurrentProcess();
382 EXPECT_FALSE(CommandLine::Init(0, NULL)); 385 EXPECT_FALSE(CommandLine::Init(0, NULL));
383 CommandLine* current = CommandLine::ForCurrentProcess(); 386 CommandLine* current = CommandLine::ForCurrentProcess();
384 EXPECT_EQ(initial, current); 387 EXPECT_EQ(initial, current);
385 } 388 }
386 389
387 // Test that copies of CommandLine have a valid StringPiece map. 390 // Test that copies of CommandLine have a valid StringPiece map.
388 TEST(CommandLineTest, Copy) { 391 TEST(CommandLineTest, Copy) {
389 scoped_ptr<CommandLine> initial(new CommandLine(CommandLine::NO_PROGRAM)); 392 scoped_ptr<CommandLine> initial(new CommandLine(CommandLine::NO_PROGRAM));
390 initial->AppendSwitch("a"); 393 initial->AppendSwitch("a");
391 initial->AppendSwitch("bbbbbbbbbbbbbbb"); 394 initial->AppendSwitch("bbbbbbbbbbbbbbb");
392 initial->AppendSwitch("c"); 395 initial->AppendSwitch("c");
393 CommandLine copy_constructed(*initial); 396 CommandLine copy_constructed(*initial);
394 CommandLine assigned = *initial; 397 CommandLine assigned = *initial;
395 CommandLine::SwitchMap switch_map = initial->GetSwitches(); 398 CommandLine::SwitchMap switch_map = initial->GetSwitches();
396 initial.reset(); 399 initial.reset();
397 for (const auto& pair : switch_map) 400 for (const auto& pair : switch_map)
398 EXPECT_TRUE(copy_constructed.HasSwitch(pair.first)); 401 EXPECT_TRUE(copy_constructed.HasSwitch(pair.first));
399 for (const auto& pair : switch_map) 402 for (const auto& pair : switch_map)
400 EXPECT_TRUE(assigned.HasSwitch(pair.first)); 403 EXPECT_TRUE(assigned.HasSwitch(pair.first));
401 } 404 }
402 405
403 } // namespace base 406 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/files/dir_reader_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698