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

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

Issue 121123002: Update uses of UTF conversions in ppapi/, printing/, remoting/, rlz/, sandbox/, skia/, sql/, sync/,… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « webkit/renderer/cpp_bound_class.cc ('k') | win8/metro_driver/secondary_tile.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 "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 10 matching lines...) Expand all
21 TEST(DelegateExecuteUtil, CommandLineFromParametersTest) { 21 TEST(DelegateExecuteUtil, CommandLineFromParametersTest) {
22 CommandLine cl(CommandLine::NO_PROGRAM); 22 CommandLine cl(CommandLine::NO_PROGRAM);
23 23
24 // Empty parameters means empty command-line string. 24 // Empty parameters means empty command-line string.
25 cl = delegate_execute::CommandLineFromParameters(NULL); 25 cl = delegate_execute::CommandLineFromParameters(NULL);
26 EXPECT_EQ(std::wstring(), cl.GetProgram().value()); 26 EXPECT_EQ(std::wstring(), cl.GetProgram().value());
27 EXPECT_EQ(CommandLine::StringType(), cl.GetCommandLineString()); 27 EXPECT_EQ(CommandLine::StringType(), cl.GetCommandLineString());
28 28
29 // Parameters with a switch are parsed properly. 29 // Parameters with a switch are parsed properly.
30 cl = delegate_execute::CommandLineFromParameters( 30 cl = delegate_execute::CommandLineFromParameters(
31 base::StringPrintf(L"--%ls", ASCIIToWide(kSomeSwitch).c_str()).c_str()); 31 base::StringPrintf(L"--%ls",
32 base::ASCIIToWide(kSomeSwitch).c_str()).c_str());
32 EXPECT_EQ(std::wstring(), cl.GetProgram().value()); 33 EXPECT_EQ(std::wstring(), cl.GetProgram().value());
33 EXPECT_TRUE(cl.HasSwitch(kSomeSwitch)); 34 EXPECT_TRUE(cl.HasSwitch(kSomeSwitch));
34 } 35 }
35 36
36 TEST(DelegateExecuteUtil, MakeChromeCommandLineTest) { 37 TEST(DelegateExecuteUtil, MakeChromeCommandLineTest) {
37 static const wchar_t kSomeArgument[] = L"http://some.url/"; 38 static const wchar_t kSomeArgument[] = L"http://some.url/";
38 static const wchar_t kOtherArgument[] = L"http://some.other.url/"; 39 static const wchar_t kOtherArgument[] = L"http://some.other.url/";
39 const base::FilePath this_exe(CommandLine::ForCurrentProcess()->GetProgram()); 40 const base::FilePath this_exe(CommandLine::ForCurrentProcess()->GetProgram());
40 41
41 CommandLine cl(CommandLine::NO_PROGRAM); 42 CommandLine cl(CommandLine::NO_PROGRAM);
(...skipping 11 matching lines...) Expand all
53 this_exe, delegate_execute::CommandLineFromParameters(NULL), 54 this_exe, delegate_execute::CommandLineFromParameters(NULL),
54 base::string16(kSomeArgument)); 55 base::string16(kSomeArgument));
55 EXPECT_EQ(2, cl.argv().size()); 56 EXPECT_EQ(2, cl.argv().size());
56 EXPECT_EQ(this_exe.value(), cl.GetProgram().value()); 57 EXPECT_EQ(this_exe.value(), cl.GetProgram().value());
57 EXPECT_EQ(1, cl.GetArgs().size()); 58 EXPECT_EQ(1, cl.GetArgs().size());
58 EXPECT_EQ(base::string16(kSomeArgument), cl.GetArgs()[0]); 59 EXPECT_EQ(base::string16(kSomeArgument), cl.GetArgs()[0]);
59 60
60 // Params with switchs and args plus arg contains the arg. 61 // Params with switchs and args plus arg contains the arg.
61 cl = delegate_execute::MakeChromeCommandLine( 62 cl = delegate_execute::MakeChromeCommandLine(
62 this_exe, delegate_execute::CommandLineFromParameters( 63 this_exe, delegate_execute::CommandLineFromParameters(
63 base::StringPrintf(L"--%ls -- %ls", ASCIIToWide(kSomeSwitch).c_str(), 64 base::StringPrintf(L"--%ls -- %ls",
65 base::ASCIIToWide(kSomeSwitch).c_str(),
64 kOtherArgument).c_str()), 66 kOtherArgument).c_str()),
65 base::string16(kSomeArgument)); 67 base::string16(kSomeArgument));
66 EXPECT_EQ(5, cl.argv().size()); 68 EXPECT_EQ(5, cl.argv().size());
67 EXPECT_EQ(this_exe.value(), cl.GetProgram().value()); 69 EXPECT_EQ(this_exe.value(), cl.GetProgram().value());
68 EXPECT_TRUE(cl.HasSwitch(kSomeSwitch)); 70 EXPECT_TRUE(cl.HasSwitch(kSomeSwitch));
69 CommandLine::StringVector args(cl.GetArgs()); 71 CommandLine::StringVector args(cl.GetArgs());
70 EXPECT_EQ(2, args.size()); 72 EXPECT_EQ(2, args.size());
71 EXPECT_NE( 73 EXPECT_NE(
72 args.end(), 74 args.end(),
73 std::find(args.begin(), args.end(), base::string16(kOtherArgument))); 75 std::find(args.begin(), args.end(), base::string16(kOtherArgument)));
74 EXPECT_NE(args.end(), 76 EXPECT_NE(args.end(),
75 std::find(args.begin(), args.end(), base::string16(kSomeArgument))); 77 std::find(args.begin(), args.end(), base::string16(kSomeArgument)));
76 } 78 }
77 79
78 TEST(DelegateExecuteUtil, ParametersFromSwitchTest) { 80 TEST(DelegateExecuteUtil, ParametersFromSwitchTest) {
79 EXPECT_EQ(base::string16(), delegate_execute::ParametersFromSwitch(NULL)); 81 EXPECT_EQ(base::string16(), delegate_execute::ParametersFromSwitch(NULL));
80 EXPECT_EQ(base::string16(L"--some-switch"), 82 EXPECT_EQ(base::string16(L"--some-switch"),
81 delegate_execute::ParametersFromSwitch(kSomeSwitch)); 83 delegate_execute::ParametersFromSwitch(kSomeSwitch));
82 } 84 }
OLDNEW
« no previous file with comments | « webkit/renderer/cpp_bound_class.cc ('k') | win8/metro_driver/secondary_tile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698