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

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

Issue 1507413003: clang/win: Let some chromium_code targets build with -Wextra. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: content_browsertests Created 5 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
« no previous file with comments | « ui/views/win/hwnd_message_handler.cc ('k') | no next file » | 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 29 matching lines...) Expand all
40 const base::FilePath this_exe( 40 const base::FilePath this_exe(
41 base::CommandLine::ForCurrentProcess()->GetProgram()); 41 base::CommandLine::ForCurrentProcess()->GetProgram());
42 42
43 base::CommandLine cl(base::CommandLine::NO_PROGRAM); 43 base::CommandLine cl(base::CommandLine::NO_PROGRAM);
44 44
45 // Empty params and argument contains only the exe. 45 // Empty params and argument contains only the exe.
46 cl = delegate_execute::MakeChromeCommandLine( 46 cl = delegate_execute::MakeChromeCommandLine(
47 this_exe, 47 this_exe,
48 delegate_execute::CommandLineFromParameters(NULL), 48 delegate_execute::CommandLineFromParameters(NULL),
49 base::string16()); 49 base::string16());
50 EXPECT_EQ(1, cl.argv().size()); 50 EXPECT_EQ(1u, cl.argv().size());
51 EXPECT_EQ(this_exe.value(), cl.GetProgram().value()); 51 EXPECT_EQ(this_exe.value(), cl.GetProgram().value());
52 52
53 // Empty params with arg contains the arg. 53 // Empty params with arg contains the arg.
54 cl = delegate_execute::MakeChromeCommandLine( 54 cl = delegate_execute::MakeChromeCommandLine(
55 this_exe, delegate_execute::CommandLineFromParameters(NULL), 55 this_exe, delegate_execute::CommandLineFromParameters(NULL),
56 base::string16(kSomeArgument)); 56 base::string16(kSomeArgument));
57 EXPECT_EQ(2, cl.argv().size()); 57 EXPECT_EQ(2u, cl.argv().size());
58 EXPECT_EQ(this_exe.value(), cl.GetProgram().value()); 58 EXPECT_EQ(this_exe.value(), cl.GetProgram().value());
59 EXPECT_EQ(1, cl.GetArgs().size()); 59 EXPECT_EQ(1u, cl.GetArgs().size());
60 EXPECT_EQ(base::string16(kSomeArgument), cl.GetArgs()[0]); 60 EXPECT_EQ(base::string16(kSomeArgument), cl.GetArgs()[0]);
61 61
62 // Params with switchs and args plus arg contains the arg. 62 // Params with switchs and args plus arg contains the arg.
63 cl = delegate_execute::MakeChromeCommandLine( 63 cl = delegate_execute::MakeChromeCommandLine(
64 this_exe, delegate_execute::CommandLineFromParameters( 64 this_exe, delegate_execute::CommandLineFromParameters(
65 base::StringPrintf(L"--%ls -- %ls", 65 base::StringPrintf(L"--%ls -- %ls",
66 base::ASCIIToUTF16(kSomeSwitch).c_str(), 66 base::ASCIIToUTF16(kSomeSwitch).c_str(),
67 kOtherArgument).c_str()), 67 kOtherArgument).c_str()),
68 base::string16(kSomeArgument)); 68 base::string16(kSomeArgument));
69 EXPECT_EQ(5, cl.argv().size()); 69 EXPECT_EQ(5u, cl.argv().size());
70 EXPECT_EQ(this_exe.value(), cl.GetProgram().value()); 70 EXPECT_EQ(this_exe.value(), cl.GetProgram().value());
71 EXPECT_TRUE(cl.HasSwitch(kSomeSwitch)); 71 EXPECT_TRUE(cl.HasSwitch(kSomeSwitch));
72 base::CommandLine::StringVector args(cl.GetArgs()); 72 base::CommandLine::StringVector args(cl.GetArgs());
73 EXPECT_EQ(2, args.size()); 73 EXPECT_EQ(2u, args.size());
74 EXPECT_NE( 74 EXPECT_NE(
75 args.end(), 75 args.end(),
76 std::find(args.begin(), args.end(), base::string16(kOtherArgument))); 76 std::find(args.begin(), args.end(), base::string16(kOtherArgument)));
77 EXPECT_NE(args.end(), 77 EXPECT_NE(args.end(),
78 std::find(args.begin(), args.end(), base::string16(kSomeArgument))); 78 std::find(args.begin(), args.end(), base::string16(kSomeArgument)));
79 } 79 }
80 80
81 TEST(DelegateExecuteUtil, ParametersFromSwitchTest) { 81 TEST(DelegateExecuteUtil, ParametersFromSwitchTest) {
82 EXPECT_EQ(base::string16(), delegate_execute::ParametersFromSwitch(NULL)); 82 EXPECT_EQ(base::string16(), delegate_execute::ParametersFromSwitch(NULL));
83 EXPECT_EQ(base::string16(L"--some-switch"), 83 EXPECT_EQ(base::string16(L"--some-switch"),
84 delegate_execute::ParametersFromSwitch(kSomeSwitch)); 84 delegate_execute::ParametersFromSwitch(kSomeSwitch));
85 } 85 }
OLDNEW
« no previous file with comments | « ui/views/win/hwnd_message_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698