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

Side by Side Diff: common/command_line_builder_unittest.cc

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 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 | « common/command_line_builder.cc ('k') | common/command_line_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
(Empty)
1 // Copyright 2008-2009 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15
16 #include "omaha/common/command_line_builder.h"
17 #include "omaha/testing/unit_test.h"
18
19 namespace omaha {
20
21 TEST(CommandLineBuilder, BuildUnknown) {
22 CommandLineBuilder builder(COMMANDLINE_MODE_UNKNOWN);
23 ExpectAsserts expect_asserts;
24 CString cmd_line = builder.GetCommandLineArgs();
25 EXPECT_STREQ(_T(""), cmd_line);
26 }
27
28 TEST(CommandLineBuilder, BuildNoArgs) {
29 CommandLineBuilder builder(COMMANDLINE_MODE_NOARGS);
30 CString cmd_line = builder.GetCommandLineArgs();
31 EXPECT_STREQ(_T(""), cmd_line);
32 }
33
34 TEST(CommandLineBuilder, BuildCore) {
35 CommandLineBuilder builder(COMMANDLINE_MODE_CORE);
36 CString cmd_line = builder.GetCommandLineArgs();
37 EXPECT_STREQ(_T("/c"), cmd_line);
38 }
39
40 TEST(CommandLineBuilder, BuildService) {
41 CommandLineBuilder builder(COMMANDLINE_MODE_SERVICE);
42 CString cmd_line = builder.GetCommandLineArgs();
43 EXPECT_STREQ(_T("/svc"), cmd_line);
44 }
45
46 TEST(CommandLineBuilder, BuildMediumService) {
47 CommandLineBuilder builder(COMMANDLINE_MODE_MEDIUM_SERVICE);
48 CString cmd_line = builder.GetCommandLineArgs();
49 EXPECT_STREQ(_T("/medsvc"), cmd_line);
50 }
51
52 TEST(CommandLineBuilder, BuildRegServer) {
53 CommandLineBuilder builder(COMMANDLINE_MODE_REGSERVER);
54 CString cmd_line = builder.GetCommandLineArgs();
55 EXPECT_STREQ(_T("/regserver"), cmd_line);
56 }
57
58 TEST(CommandLineBuilder, BuildUnregServer) {
59 CommandLineBuilder builder(COMMANDLINE_MODE_UNREGSERVER);
60 CString cmd_line = builder.GetCommandLineArgs();
61 EXPECT_STREQ(_T("/unregserver"), cmd_line);
62 }
63
64 TEST(CommandLineBuilder, BuildNetDiags) {
65 CommandLineBuilder builder(COMMANDLINE_MODE_NETDIAGS);
66 CString cmd_line = builder.GetCommandLineArgs();
67 EXPECT_STREQ(_T("/netdiags"), cmd_line);
68 }
69
70 TEST(CommandLineBuilder, BuildCrashNoFilename) {
71 CommandLineBuilder builder(COMMANDLINE_MODE_CRASH);
72 CString cmd_line = builder.GetCommandLineArgs();
73 EXPECT_STREQ(_T("/crash"), cmd_line);
74 }
75
76 TEST(CommandLineBuilder, BuildReportCrash) {
77 CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
78 ExpectAsserts expect_asserts; // Missing filename.
79 CString cmd_line = builder.GetCommandLineArgs();
80 EXPECT_STREQ(_T(""), cmd_line);
81 }
82
83 TEST(CommandLineBuilder, BuildReportCrashWithFilename) {
84 CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
85 builder.set_crash_filename(_T("foo.dmp"));
86 CString cmd_line = builder.GetCommandLineArgs();
87 EXPECT_STREQ(_T("/report \"foo.dmp\""), cmd_line);
88 }
89
90 TEST(CommandLineBuilder, BuildReportCrashWithFilenameMachine) {
91 CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
92 builder.set_crash_filename(_T("foo.dmp"));
93 builder.set_is_machine_set(true);
94 CString cmd_line = builder.GetCommandLineArgs();
95 EXPECT_STREQ(_T("/report \"foo.dmp\" /machine"), cmd_line);
96 }
97
98 TEST(CommandLineBuilder, BuildReportCrashWithEnclosedFilename) {
99 CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
100 builder.set_crash_filename(_T("\"foo.dmp\""));
101 CString cmd_line = builder.GetCommandLineArgs();
102 EXPECT_STREQ(_T("/report \"foo.dmp\""), cmd_line);
103 }
104
105 TEST(CommandLineBuilder, BuildReportCrashWithCustomInfo) {
106 CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
107 ExpectAsserts expect_asserts; // Missing filename.
108 builder.set_custom_info_filename(_T("foo.txt"));
109 CString cmd_line = builder.GetCommandLineArgs();
110 EXPECT_STREQ(_T(""), cmd_line);
111 }
112
113 TEST(CommandLineBuilder, BuildReportCrashWithFileanameWithCustomInfo) {
114 CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
115 builder.set_crash_filename(_T("foo.dmp"));
116 builder.set_custom_info_filename(_T("foo.txt"));
117 CString cmd_line = builder.GetCommandLineArgs();
118 EXPECT_STREQ(_T("/report \"foo.dmp\" /custom_info_filename \"foo.txt\""),
119 cmd_line);
120 }
121
122 TEST(CommandLineBuilder, BuildReportCrashWithFileanameWithCustomInfoMachine) {
123 CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
124 builder.set_crash_filename(_T("foo.dmp"));
125 builder.set_custom_info_filename(_T("foo.txt"));
126 builder.set_is_machine_set(true);
127 CString cmd_line = builder.GetCommandLineArgs();
128 EXPECT_STREQ(
129 _T("/report \"foo.dmp\" /machine /custom_info_filename \"foo.txt\""),
130 cmd_line);
131 }
132
133 TEST(CommandLineBuilder, BuildReportCrashWithEnclosedFileanameWithCustomInfo) {
134 CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
135 builder.set_crash_filename(_T("\"foo.dmp\""));
136 builder.set_custom_info_filename(_T("\"foo.txt\""));
137 CString cmd_line = builder.GetCommandLineArgs();
138 EXPECT_STREQ(_T("/report \"foo.dmp\" /custom_info_filename \"foo.txt\""),
139 cmd_line);
140 }
141
142 TEST(CommandLineBuilder, BuildReportCrashInteractiveWithFilename) {
143 CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
144 builder.set_crash_filename(_T("foo.dmp"));
145 builder.set_is_interactive_set(true);
146 CString cmd_line = builder.GetCommandLineArgs();
147 EXPECT_STREQ(_T("/report /i \"foo.dmp\""), cmd_line);
148 }
149
150 TEST(CommandLineBuilder, BuildReportCrashMachineInteractiveWithFilename) {
151 CommandLineBuilder builder(COMMANDLINE_MODE_REPORTCRASH);
152 builder.set_crash_filename(_T("foo.dmp"));
153 builder.set_is_machine_set(true);
154 builder.set_is_interactive_set(true);
155 CString cmd_line = builder.GetCommandLineArgs();
156 EXPECT_STREQ(_T("/report /i \"foo.dmp\" /machine"), cmd_line);
157 }
158
159 TEST(CommandLineBuilder, BuildInstall) {
160 CommandLineBuilder builder(COMMANDLINE_MODE_INSTALL);
161 ExpectAsserts expect_asserts; // Missing parameters.
162 CString cmd_line = builder.GetCommandLineArgs();
163 EXPECT_STREQ(_T(""), cmd_line);
164 }
165
166 TEST(CommandLineBuilder, BuildInstallWithExtraArgs) {
167 CommandLineBuilder builder(COMMANDLINE_MODE_INSTALL);
168 builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
169 _T("appname=YouTubeUploader&needsadmin=False&")
170 _T("lang=en"));
171 CString cmd_line = builder.GetCommandLineArgs();
172 EXPECT_STREQ(_T("/install \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
173 _T("appname=YouTubeUploader&needsadmin=False&lang=en\""),
174 cmd_line);
175 }
176
177 TEST(CommandLineBuilder, BuildInstallWithExtraArgsSilent) {
178 CommandLineBuilder builder(COMMANDLINE_MODE_INSTALL);
179 builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
180 _T("appname=YouTubeUploader&needsadmin=False&")
181 _T("lang=en"));
182 builder.set_is_silent_set(true);
183 CString cmd_line = builder.GetCommandLineArgs();
184 EXPECT_STREQ(_T("/install \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
185 _T("appname=YouTubeUploader&needsadmin=False&lang=en\" /silent"),
186 cmd_line);
187 }
188
189 TEST(CommandLineBuilder, BuildInstallWithExtraArgsSessionId) {
190 CommandLineBuilder builder(COMMANDLINE_MODE_INSTALL);
191 builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
192 _T("appname=YouTubeUploader&needsadmin=False&")
193 _T("lang=en"));
194 builder.set_session_id(_T("{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}"));
195 CString cmd_line = builder.GetCommandLineArgs();
196 EXPECT_STREQ(_T("/install \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
197 _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
198 _T(" /sessionid \"{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}\""),
199 cmd_line);
200 }
201
202 TEST(CommandLineBuilder, BuildUpdate) {
203 CommandLineBuilder builder(COMMANDLINE_MODE_UPDATE);
204 CString cmd_line = builder.GetCommandLineArgs();
205 EXPECT_STREQ(_T("/update"), cmd_line);
206 }
207
208 TEST(CommandLineBuilder, BuildUpdateWithSessionId) {
209 CommandLineBuilder builder(COMMANDLINE_MODE_UPDATE);
210 builder.set_session_id(_T("{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}"));
211 CString cmd_line = builder.GetCommandLineArgs();
212 EXPECT_STREQ(
213 _T("/update /sessionid \"{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}\""),
214 cmd_line);
215 }
216
217 // The /update builder works when not used with GoogleUpdate.exe.
218 TEST(CommandLineBuilder, BuildUpdateAndGetCommandLineWithNonGoogleUpdateExe) {
219 CommandLineBuilder builder(COMMANDLINE_MODE_UPDATE);
220 CString cmd_line = builder.GetCommandLine(_T("C:\\GoogleUpdateSetup_en.exe"));
221 EXPECT_STREQ(_T("\"C:\\GoogleUpdateSetup_en.exe\" /update"), cmd_line);
222 }
223
224 // The /update builder should not be used with GoogleUpdate.exe directly.
225 TEST(CommandLineBuilder, BuildUpdateAndGetCommandLineWithGoogleUpdateExe) {
226 CommandLineBuilder builder(COMMANDLINE_MODE_UPDATE);
227 ExpectAsserts expect_asserts;
228 CString cmd_line = builder.GetCommandLine(_T("C:\\GoogleUpdate.exe"));
229 EXPECT_STREQ(_T("\"C:\\GoogleUpdate.exe\" /update"), cmd_line);
230 }
231
232 TEST(CommandLineBuilder, BuildComServer) {
233 CommandLineBuilder builder(COMMANDLINE_MODE_COMSERVER);
234 CString cmd_line = builder.GetCommandLineArgs();
235 EXPECT_STREQ(_T("-Embedding"), cmd_line);
236 }
237
238 TEST(CommandLineBuilder, BuildComBroker) {
239 CommandLineBuilder builder(COMMANDLINE_MODE_COMBROKER);
240 CString cmd_line = builder.GetCommandLineArgs();
241 EXPECT_STREQ(_T("/broker"), cmd_line);
242 }
243
244 TEST(CommandLineBuilder, BuildOnDemand) {
245 CommandLineBuilder builder(COMMANDLINE_MODE_ONDEMAND);
246 CString cmd_line = builder.GetCommandLineArgs();
247 EXPECT_STREQ(_T("/ondemand"), cmd_line);
248 }
249
250 TEST(CommandLineBuilder, BuildCodeRedCheck) {
251 CommandLineBuilder builder(COMMANDLINE_MODE_CODE_RED_CHECK);
252 CString cmd_line = builder.GetCommandLineArgs();
253 EXPECT_STREQ(_T("/cr"), cmd_line);
254 }
255
256 TEST(CommandLineBuilder, BuildWebPlugin) {
257 CommandLineBuilder builder(COMMANDLINE_MODE_WEBPLUGIN);
258 ExpectAsserts expect_asserts;
259 CString cmd_line = builder.GetCommandLineArgs();
260 EXPECT_STREQ(_T(""), cmd_line);
261 }
262
263 TEST(CommandLineBuilder, BuildWebPluginWithUrlArgsAndInstallSource) {
264 CommandLineBuilder builder(COMMANDLINE_MODE_WEBPLUGIN);
265 builder.set_webplugin_args(_T("piargs"));
266 builder.set_webplugin_url_domain(_T("http://www.google.com/"));
267 builder.set_install_source(_T("oneclick"));
268 CString cmd_line = builder.GetCommandLineArgs();
269 EXPECT_STREQ(_T("/pi \"http://www.google.com/\" \"piargs\"")
270 _T(" /installsource oneclick"),
271 cmd_line);
272 }
273
274 TEST(CommandLineBuilder, BuildRecover) {
275 CommandLineBuilder builder(COMMANDLINE_MODE_RECOVER);
276 ExpectAsserts expect_asserts;
277 CString cmd_line = builder.GetCommandLineArgs();
278 EXPECT_STREQ(_T(""), cmd_line);
279 }
280
281 TEST(CommandLineBuilder, BuildRecoverWithMIPath) {
282 CommandLineBuilder builder(COMMANDLINE_MODE_RECOVER);
283 builder.set_code_red_metainstaller_path(_T("foo.exe"));
284 CString cmd_line = builder.GetCommandLineArgs();
285 EXPECT_STREQ(_T("/recover foo.exe"), cmd_line);
286 }
287
288 TEST(CommandLineBuilder, BuildUA) {
289 CommandLineBuilder builder(COMMANDLINE_MODE_UA);
290 ExpectAsserts expect_asserts;
291 CString cmd_line = builder.GetCommandLineArgs();
292 EXPECT_STREQ(_T(""), cmd_line);
293 }
294
295 TEST(CommandLineBuilder, BuildUAWithInstallSource) {
296 CommandLineBuilder builder(COMMANDLINE_MODE_UA);
297 builder.set_install_source(_T("blah"));
298 CString cmd_line = builder.GetCommandLineArgs();
299 EXPECT_STREQ(_T("/ua /installsource blah"), cmd_line);
300 }
301
302 TEST(CommandLineBuilder, BuildHandoffInstall) {
303 CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
304 ExpectAsserts expect_asserts; // Missing extra args.
305 CString cmd_line = builder.GetCommandLineArgs();
306 EXPECT_STREQ(_T(""), cmd_line);
307 }
308
309 TEST(CommandLineBuilder, BuildHandoffInstallWithExtraArgs) {
310 CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
311 builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
312 _T("appname=YouTubeUploader&needsadmin=False&")
313 _T("lang=en"));
314 CString cmd_line = builder.GetCommandLineArgs();
315 EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
316 _T("appname=YouTubeUploader&needsadmin=False&lang=en\""),
317 cmd_line);
318 }
319
320 TEST(CommandLineBuilder, BuildHandoffInstallWithExtraArgsSessionId) {
321 CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
322 builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
323 _T("appname=YouTubeUploader&needsadmin=False&")
324 _T("lang=en"));
325 builder.set_session_id(_T("{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}"));
326 CString cmd_line = builder.GetCommandLineArgs();
327 EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
328 _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
329 _T(" /sessionid \"{756dfdc2-0ef0-44b7-bfb1-21a4be6a1213}\""),
330 cmd_line);
331 }
332
333 TEST(CommandLineBuilder, BuildHandoffInstallWithExtraArgsOffline) {
334 CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
335 builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
336 _T("appname=YouTubeUploader&needsadmin=False&")
337 _T("lang=en"));
338 builder.set_install_source(_T("offline"));
339 builder.SetOfflineDir(_T("c:\\offline_dir\\"));
340
341 CString cmd_line = builder.GetCommandLineArgs();
342 EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
343 _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
344 _T(" /installsource offline")
345 _T(" /offlinedir \"c:\\offline_dir\""),
346 cmd_line);
347 }
348
349 TEST(CommandLineBuilder, BuildHandoffInstallWithExtraArgsSilentOffline) {
350 CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
351 builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
352 _T("appname=YouTubeUploader&needsadmin=False&")
353 _T("lang=en"));
354 builder.set_install_source(_T("offline"));
355 builder.set_is_silent_set(true);
356 builder.SetOfflineDir(_T("c:\\offline dir"));
357
358 CString cmd_line = builder.GetCommandLineArgs();
359 EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
360 _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
361 _T(" /installsource offline")
362 _T(" /silent /offlinedir \"c:\\offline dir\""),
363 cmd_line);
364 }
365
366 TEST(CommandLineBuilder, BuildHandoffWithAppArgsSilentOffline) {
367 CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
368 builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
369 _T("appname=YouTubeUploader&needsadmin=False&")
370 _T("lang=en"));
371 builder.set_app_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
372 _T("installerdata=foobar%45"));
373 builder.set_install_source(_T("offline"));
374 builder.set_is_silent_set(true);
375 builder.SetOfflineDir(_T("c:\\offline dir"));
376
377 CString cmd_line = builder.GetCommandLineArgs();
378 EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
379 _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
380 _T(" /appargs \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
381 _T("installerdata=foobar%45\"")
382 _T(" /installsource offline")
383 _T(" /silent /offlinedir \"c:\\offline dir\""),
384 cmd_line);
385 }
386
387 TEST(CommandLineBuilder, BuildHandoffWithAppArgsSilentOfflineEulaRequired) {
388 CommandLineBuilder builder(COMMANDLINE_MODE_HANDOFF_INSTALL);
389 builder.set_extra_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
390 _T("appname=YouTubeUploader&needsadmin=False&")
391 _T("lang=en"));
392 builder.set_app_args(_T("appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
393 _T("installerdata=foobar%45"));
394 builder.set_install_source(_T("offline"));
395 builder.set_is_silent_set(true);
396 builder.set_is_eula_required_set(true);
397 builder.SetOfflineDir(_T("c:\\offline dir"));
398
399 CString cmd_line = builder.GetCommandLineArgs();
400 EXPECT_STREQ(_T("/handoff \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
401 _T("appname=YouTubeUploader&needsadmin=False&lang=en\"")
402 _T(" /appargs \"appguid={A4F7B07B-B9BD-4a33-B136-96D2ADFB60CB}&")
403 _T("installerdata=foobar%45\"")
404 _T(" /installsource offline")
405 _T(" /silent /eularequired /offlinedir \"c:\\offline dir\""),
406 cmd_line);
407 }
408
409 TEST(CommandLineBuilder, BuildRegisterProduct) {
410 CommandLineBuilder builder(COMMANDLINE_MODE_REGISTER_PRODUCT);
411 builder.set_extra_args(_T("appguid={7DD3DAE3-87F1-4CFE-8BF4-452C74421401}&")
412 _T("appname=Google Toolbar&needsadmin=True&")
413 _T("lang=en"));
414 CString cmd_line = builder.GetCommandLineArgs();
415 EXPECT_STREQ(_T("/registerproduct ")
416 _T("\"appguid={7DD3DAE3-87F1-4CFE-8BF4-452C74421401}&")
417 _T("appname=Google Toolbar&needsadmin=True&lang=en\""),
418 cmd_line);
419 }
420
421 TEST(CommandLineBuilder, BuildUnregisterProduc) {
422 CommandLineBuilder builder(COMMANDLINE_MODE_UNREGISTER_PRODUCT);
423 builder.set_extra_args(_T("appguid={7DD3DAE3-87F1-4CFE-8BF4-452C74421401}&")
424 _T("needsadmin=True&lang=en"));
425 CString cmd_line = builder.GetCommandLineArgs();
426 EXPECT_STREQ(_T("/unregisterproduct ")
427 _T("\"appguid={7DD3DAE3-87F1-4CFE-8BF4-452C74421401}&")
428 _T("needsadmin=True&lang=en\""),
429 cmd_line);
430 }
431
432 TEST(CommandLineBuilder, BuildUninstall) {
433 CommandLineBuilder builder(COMMANDLINE_MODE_UNINSTALL);
434 CString cmd_line = builder.GetCommandLineArgs();
435 EXPECT_STREQ(_T("/uninstall"), cmd_line);
436 }
437
438 TEST(CommandLineBuilder, BuildPing) {
439 CommandLineBuilder builder(COMMANDLINE_MODE_PING);
440 builder.set_ping_string(_T("foo"));
441 CString cmd_line = builder.GetCommandLineArgs();
442 EXPECT_STREQ(_T("/ping foo"), cmd_line);
443 }
444
445 } // namespace omaha
446
OLDNEW
« no previous file with comments | « common/command_line_builder.cc ('k') | common/command_line_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698