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

Side by Side Diff: win8/delegate_execute/delegate_execute_util_unittest.cc

Issue 119733002: Add base:: to string16s in win8/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « win8/delegate_execute/delegate_execute_util.cc ('k') | win8/metro_driver/chrome_app_view.h » ('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 "win8/delegate_execute/delegate_execute_util.h" 5 #include "win8/delegate_execute/delegate_execute_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
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 24 matching lines...) Expand all
35 35
36 TEST(DelegateExecuteUtil, MakeChromeCommandLineTest) { 36 TEST(DelegateExecuteUtil, MakeChromeCommandLineTest) {
37 static const wchar_t kSomeArgument[] = L"http://some.url/"; 37 static const wchar_t kSomeArgument[] = L"http://some.url/";
38 static const wchar_t kOtherArgument[] = L"http://some.other.url/"; 38 static const wchar_t kOtherArgument[] = L"http://some.other.url/";
39 const base::FilePath this_exe(CommandLine::ForCurrentProcess()->GetProgram()); 39 const base::FilePath this_exe(CommandLine::ForCurrentProcess()->GetProgram());
40 40
41 CommandLine cl(CommandLine::NO_PROGRAM); 41 CommandLine cl(CommandLine::NO_PROGRAM);
42 42
43 // Empty params and argument contains only the exe. 43 // Empty params and argument contains only the exe.
44 cl = delegate_execute::MakeChromeCommandLine( 44 cl = delegate_execute::MakeChromeCommandLine(
45 this_exe, delegate_execute::CommandLineFromParameters(NULL), string16()); 45 this_exe,
46 delegate_execute::CommandLineFromParameters(NULL),
47 base::string16());
46 EXPECT_EQ(1, cl.argv().size()); 48 EXPECT_EQ(1, cl.argv().size());
47 EXPECT_EQ(this_exe.value(), cl.GetProgram().value()); 49 EXPECT_EQ(this_exe.value(), cl.GetProgram().value());
48 50
49 // Empty params with arg contains the arg. 51 // Empty params with arg contains the arg.
50 cl = delegate_execute::MakeChromeCommandLine( 52 cl = delegate_execute::MakeChromeCommandLine(
51 this_exe, delegate_execute::CommandLineFromParameters(NULL), 53 this_exe, delegate_execute::CommandLineFromParameters(NULL),
52 string16(kSomeArgument)); 54 base::string16(kSomeArgument));
53 EXPECT_EQ(2, cl.argv().size()); 55 EXPECT_EQ(2, cl.argv().size());
54 EXPECT_EQ(this_exe.value(), cl.GetProgram().value()); 56 EXPECT_EQ(this_exe.value(), cl.GetProgram().value());
55 EXPECT_EQ(1, cl.GetArgs().size()); 57 EXPECT_EQ(1, cl.GetArgs().size());
56 EXPECT_EQ(string16(kSomeArgument), cl.GetArgs()[0]); 58 EXPECT_EQ(base::string16(kSomeArgument), cl.GetArgs()[0]);
57 59
58 // Params with switchs and args plus arg contains the arg. 60 // Params with switchs and args plus arg contains the arg.
59 cl = delegate_execute::MakeChromeCommandLine( 61 cl = delegate_execute::MakeChromeCommandLine(
60 this_exe, delegate_execute::CommandLineFromParameters( 62 this_exe, delegate_execute::CommandLineFromParameters(
61 base::StringPrintf(L"--%ls -- %ls", ASCIIToWide(kSomeSwitch).c_str(), 63 base::StringPrintf(L"--%ls -- %ls", ASCIIToWide(kSomeSwitch).c_str(),
62 kOtherArgument).c_str()), 64 kOtherArgument).c_str()),
63 string16(kSomeArgument)); 65 base::string16(kSomeArgument));
64 EXPECT_EQ(5, cl.argv().size()); 66 EXPECT_EQ(5, cl.argv().size());
65 EXPECT_EQ(this_exe.value(), cl.GetProgram().value()); 67 EXPECT_EQ(this_exe.value(), cl.GetProgram().value());
66 EXPECT_TRUE(cl.HasSwitch(kSomeSwitch)); 68 EXPECT_TRUE(cl.HasSwitch(kSomeSwitch));
67 CommandLine::StringVector args(cl.GetArgs()); 69 CommandLine::StringVector args(cl.GetArgs());
68 EXPECT_EQ(2, args.size()); 70 EXPECT_EQ(2, args.size());
71 EXPECT_NE(
72 args.end(),
73 std::find(args.begin(), args.end(), base::string16(kOtherArgument)));
69 EXPECT_NE(args.end(), 74 EXPECT_NE(args.end(),
70 std::find(args.begin(), args.end(), string16(kOtherArgument))); 75 std::find(args.begin(), args.end(), base::string16(kSomeArgument)));
71 EXPECT_NE(args.end(),
72 std::find(args.begin(), args.end(), string16(kSomeArgument)));
73 } 76 }
74 77
75 TEST(DelegateExecuteUtil, ParametersFromSwitchTest) { 78 TEST(DelegateExecuteUtil, ParametersFromSwitchTest) {
76 EXPECT_EQ(string16(), delegate_execute::ParametersFromSwitch(NULL)); 79 EXPECT_EQ(base::string16(), delegate_execute::ParametersFromSwitch(NULL));
77 EXPECT_EQ(string16(L"--some-switch"), 80 EXPECT_EQ(base::string16(L"--some-switch"),
78 delegate_execute::ParametersFromSwitch(kSomeSwitch)); 81 delegate_execute::ParametersFromSwitch(kSomeSwitch));
79 } 82 }
OLDNEW
« no previous file with comments | « win8/delegate_execute/delegate_execute_util.cc ('k') | win8/metro_driver/chrome_app_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698