OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/test/chromedriver/capabilities.h" | 5 #include "chrome/test/chromedriver/capabilities.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/test/chromedriver/chrome/log.h" | 8 #include "chrome/test/chromedriver/chrome/log.h" |
9 #include "chrome/test/chromedriver/chrome/status.h" | 9 #include "chrome/test/chromedriver/chrome/status.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
| 12 TEST(Switches, Empty) { |
| 13 Switches switches; |
| 14 CommandLine cmd(CommandLine::NO_PROGRAM); |
| 15 switches.AppendToCommandLine(&cmd); |
| 16 ASSERT_EQ(0u, cmd.GetSwitches().size()); |
| 17 ASSERT_EQ("", switches.ToString()); |
| 18 } |
| 19 |
| 20 TEST(Switches, NoValue) { |
| 21 Switches switches; |
| 22 switches.SetSwitch("hello"); |
| 23 |
| 24 ASSERT_TRUE(switches.HasSwitch("hello")); |
| 25 ASSERT_EQ("", switches.GetSwitchValue("hello")); |
| 26 |
| 27 CommandLine cmd(CommandLine::NO_PROGRAM); |
| 28 switches.AppendToCommandLine(&cmd); |
| 29 ASSERT_TRUE(cmd.HasSwitch("hello")); |
| 30 ASSERT_EQ(FILE_PATH_LITERAL(""), cmd.GetSwitchValueNative("hello")); |
| 31 ASSERT_EQ("--hello", switches.ToString()); |
| 32 } |
| 33 |
| 34 TEST(Switches, Value) { |
| 35 Switches switches; |
| 36 switches.SetSwitch("hello", "there"); |
| 37 |
| 38 ASSERT_TRUE(switches.HasSwitch("hello")); |
| 39 ASSERT_EQ("there", switches.GetSwitchValue("hello")); |
| 40 |
| 41 CommandLine cmd(CommandLine::NO_PROGRAM); |
| 42 switches.AppendToCommandLine(&cmd); |
| 43 ASSERT_TRUE(cmd.HasSwitch("hello")); |
| 44 ASSERT_EQ(FILE_PATH_LITERAL("there"), cmd.GetSwitchValueNative("hello")); |
| 45 ASSERT_EQ("--hello=there", switches.ToString()); |
| 46 } |
| 47 |
| 48 TEST(Switches, FromOther) { |
| 49 Switches switches; |
| 50 switches.SetSwitch("a", "1"); |
| 51 switches.SetSwitch("b", "1"); |
| 52 |
| 53 Switches switches2; |
| 54 switches2.SetSwitch("b", "2"); |
| 55 switches2.SetSwitch("c", "2"); |
| 56 |
| 57 switches.SetFromSwitches(switches2); |
| 58 ASSERT_EQ("--a=1 --b=2 --c=2", switches.ToString()); |
| 59 } |
| 60 |
| 61 TEST(Switches, Remove) { |
| 62 Switches switches; |
| 63 switches.SetSwitch("a", "1"); |
| 64 switches.RemoveSwitch("a"); |
| 65 ASSERT_FALSE(switches.HasSwitch("a")); |
| 66 } |
| 67 |
| 68 TEST(Switches, Quoting) { |
| 69 Switches switches; |
| 70 switches.SetSwitch("hello", "a b"); |
| 71 switches.SetSwitch("hello2", " '\" "); |
| 72 |
| 73 ASSERT_EQ("--hello=\"a b\" --hello2=\" '\\\" \"", switches.ToString()); |
| 74 } |
| 75 |
| 76 TEST(Switches, Multiple) { |
| 77 Switches switches; |
| 78 switches.SetSwitch("switch"); |
| 79 switches.SetSwitch("hello", "there"); |
| 80 |
| 81 CommandLine cmd(CommandLine::NO_PROGRAM); |
| 82 switches.AppendToCommandLine(&cmd); |
| 83 ASSERT_TRUE(cmd.HasSwitch("switch")); |
| 84 ASSERT_TRUE(cmd.HasSwitch("hello")); |
| 85 ASSERT_EQ(FILE_PATH_LITERAL("there"), cmd.GetSwitchValueNative("hello")); |
| 86 ASSERT_EQ("--hello=there --switch", switches.ToString()); |
| 87 } |
| 88 |
| 89 TEST(Switches, Unparsed) { |
| 90 Switches switches; |
| 91 switches.SetUnparsedSwitch("a"); |
| 92 switches.SetUnparsedSwitch("--b"); |
| 93 switches.SetUnparsedSwitch("--c=1"); |
| 94 switches.SetUnparsedSwitch("d=1"); |
| 95 switches.SetUnparsedSwitch("-e=--1=1"); |
| 96 |
| 97 ASSERT_EQ("---e=--1=1 --a --b --c=1 --d=1", switches.ToString()); |
| 98 } |
| 99 |
12 TEST(ParseCapabilities, WithAndroidPackage) { | 100 TEST(ParseCapabilities, WithAndroidPackage) { |
13 Capabilities capabilities; | 101 Capabilities capabilities; |
14 base::DictionaryValue caps; | 102 base::DictionaryValue caps; |
15 caps.SetString("chromeOptions.androidPackage", "abc"); | 103 caps.SetString("chromeOptions.androidPackage", "abc"); |
16 Logger log(Log::kError); | 104 Logger log(Log::kError); |
17 Status status = capabilities.Parse(caps, &log); | 105 Status status = capabilities.Parse(caps, &log); |
18 ASSERT_TRUE(status.IsOk()); | 106 ASSERT_TRUE(status.IsOk()); |
19 ASSERT_TRUE(capabilities.IsAndroid()); | 107 ASSERT_TRUE(capabilities.IsAndroid()); |
20 ASSERT_EQ("abc", capabilities.android_package); | 108 ASSERT_EQ("abc", capabilities.android_package); |
21 } | 109 } |
(...skipping 19 matching lines...) Expand all Loading... |
41 TEST(ParseCapabilities, LogPath) { | 129 TEST(ParseCapabilities, LogPath) { |
42 Capabilities capabilities; | 130 Capabilities capabilities; |
43 base::DictionaryValue caps; | 131 base::DictionaryValue caps; |
44 caps.SetString("chromeOptions.logPath", "path/to/logfile"); | 132 caps.SetString("chromeOptions.logPath", "path/to/logfile"); |
45 Logger log(Log::kError); | 133 Logger log(Log::kError); |
46 Status status = capabilities.Parse(caps, &log); | 134 Status status = capabilities.Parse(caps, &log); |
47 ASSERT_TRUE(status.IsOk()); | 135 ASSERT_TRUE(status.IsOk()); |
48 ASSERT_STREQ("path/to/logfile", capabilities.log_path.c_str()); | 136 ASSERT_STREQ("path/to/logfile", capabilities.log_path.c_str()); |
49 } | 137 } |
50 | 138 |
51 TEST(ParseCapabilities, NoArgs) { | 139 TEST(ParseCapabilities, Args) { |
52 Capabilities capabilities; | |
53 base::ListValue args; | |
54 ASSERT_TRUE(args.empty()); | |
55 base::DictionaryValue caps; | |
56 caps.Set("chromeOptions.args", args.DeepCopy()); | |
57 Logger log(Log::kError); | |
58 Status status = capabilities.Parse(caps, &log); | |
59 ASSERT_TRUE(status.IsOk()); | |
60 ASSERT_TRUE(capabilities.command.GetSwitches().empty()); | |
61 } | |
62 | |
63 TEST(ParseCapabilities, SingleArgWithoutValue) { | |
64 Capabilities capabilities; | |
65 base::ListValue args; | |
66 args.AppendString("enable-nacl"); | |
67 ASSERT_EQ(1u, args.GetSize()); | |
68 base::DictionaryValue caps; | |
69 caps.Set("chromeOptions.args", args.DeepCopy()); | |
70 Logger log(Log::kError); | |
71 Status status = capabilities.Parse(caps, &log); | |
72 ASSERT_TRUE(status.IsOk()); | |
73 ASSERT_EQ(1u, capabilities.command.GetSwitches().size()); | |
74 ASSERT_TRUE(capabilities.command.HasSwitch("enable-nacl")); | |
75 } | |
76 | |
77 TEST(ParseCapabilities, SingleArgWithValue) { | |
78 Capabilities capabilities; | |
79 base::ListValue args; | |
80 args.AppendString("load-extension=/test/extension"); | |
81 ASSERT_EQ(1u, args.GetSize()); | |
82 base::DictionaryValue caps; | |
83 caps.Set("chromeOptions.args", args.DeepCopy()); | |
84 Logger log(Log::kError); | |
85 Status status = capabilities.Parse(caps, &log); | |
86 ASSERT_TRUE(status.IsOk()); | |
87 ASSERT_EQ(1u, capabilities.command.GetSwitches().size()); | |
88 ASSERT_TRUE(capabilities.command.HasSwitch("load-extension")); | |
89 ASSERT_STREQ( | |
90 "/test/extension", | |
91 capabilities.command.GetSwitchValueASCII("load-extension").c_str()); | |
92 } | |
93 | |
94 TEST(ParseCapabilities, MultipleArgs) { | |
95 Capabilities capabilities; | 140 Capabilities capabilities; |
96 base::ListValue args; | 141 base::ListValue args; |
97 args.AppendString("arg1"); | 142 args.AppendString("arg1"); |
98 args.AppendString("arg2=val"); | 143 args.AppendString("arg2=val"); |
99 args.AppendString("arg3='a space'"); | |
100 ASSERT_EQ(3u, args.GetSize()); | |
101 base::DictionaryValue caps; | 144 base::DictionaryValue caps; |
102 caps.Set("chromeOptions.args", args.DeepCopy()); | 145 caps.Set("chromeOptions.args", args.DeepCopy()); |
| 146 |
103 Logger log(Log::kError); | 147 Logger log(Log::kError); |
104 Status status = capabilities.Parse(caps, &log); | 148 Status status = capabilities.Parse(caps, &log); |
105 ASSERT_TRUE(status.IsOk()); | 149 ASSERT_TRUE(status.IsOk()); |
106 ASSERT_EQ(3u, capabilities.command.GetSwitches().size()); | 150 |
107 ASSERT_TRUE(capabilities.command.HasSwitch("arg1")); | 151 ASSERT_EQ(2u, capabilities.switches.GetSize()); |
108 ASSERT_TRUE(capabilities.command.HasSwitch("arg2")); | 152 ASSERT_TRUE(capabilities.switches.HasSwitch("arg1")); |
109 ASSERT_STREQ("val", capabilities.command.GetSwitchValueASCII("arg2").c_str()); | 153 ASSERT_TRUE(capabilities.switches.HasSwitch("arg2")); |
110 ASSERT_TRUE(capabilities.command.HasSwitch("arg3")); | 154 ASSERT_EQ("", capabilities.switches.GetSwitchValue("arg1")); |
111 ASSERT_STREQ("'a space'", | 155 ASSERT_EQ("val", capabilities.switches.GetSwitchValue("arg2")); |
112 capabilities.command.GetSwitchValueASCII("arg3").c_str()); | |
113 } | 156 } |
114 | 157 |
115 TEST(ParseCapabilities, Prefs) { | 158 TEST(ParseCapabilities, Prefs) { |
116 Capabilities capabilities; | 159 Capabilities capabilities; |
117 base::DictionaryValue prefs; | 160 base::DictionaryValue prefs; |
118 prefs.SetString("key1", "value1"); | 161 prefs.SetString("key1", "value1"); |
119 prefs.SetString("key2.k", "value2"); | 162 prefs.SetString("key2.k", "value2"); |
120 base::DictionaryValue caps; | 163 base::DictionaryValue caps; |
121 caps.Set("chromeOptions.prefs", prefs.DeepCopy()); | 164 caps.Set("chromeOptions.prefs", prefs.DeepCopy()); |
122 Logger log(Log::kError); | 165 Logger log(Log::kError); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 220 |
178 TEST(ParseCapabilities, DirectProxy) { | 221 TEST(ParseCapabilities, DirectProxy) { |
179 Capabilities capabilities; | 222 Capabilities capabilities; |
180 base::DictionaryValue proxy; | 223 base::DictionaryValue proxy; |
181 proxy.SetString("proxyType", "DIRECT"); | 224 proxy.SetString("proxyType", "DIRECT"); |
182 base::DictionaryValue caps; | 225 base::DictionaryValue caps; |
183 caps.Set("proxy", proxy.DeepCopy()); | 226 caps.Set("proxy", proxy.DeepCopy()); |
184 Logger log(Log::kError); | 227 Logger log(Log::kError); |
185 Status status = capabilities.Parse(caps, &log); | 228 Status status = capabilities.Parse(caps, &log); |
186 ASSERT_TRUE(status.IsOk()); | 229 ASSERT_TRUE(status.IsOk()); |
187 ASSERT_EQ(1u, capabilities.command.GetSwitches().size()); | 230 ASSERT_EQ(1u, capabilities.switches.GetSize()); |
188 ASSERT_TRUE(capabilities.command.HasSwitch("no-proxy-server")); | 231 ASSERT_TRUE(capabilities.switches.HasSwitch("no-proxy-server")); |
189 } | 232 } |
190 | 233 |
191 TEST(ParseCapabilities, SystemProxy) { | 234 TEST(ParseCapabilities, SystemProxy) { |
192 Capabilities capabilities; | 235 Capabilities capabilities; |
193 base::DictionaryValue proxy; | 236 base::DictionaryValue proxy; |
194 proxy.SetString("proxyType", "system"); | 237 proxy.SetString("proxyType", "system"); |
195 base::DictionaryValue caps; | 238 base::DictionaryValue caps; |
196 caps.Set("proxy", proxy.DeepCopy()); | 239 caps.Set("proxy", proxy.DeepCopy()); |
197 Logger log(Log::kError); | 240 Logger log(Log::kError); |
198 Status status = capabilities.Parse(caps, &log); | 241 Status status = capabilities.Parse(caps, &log); |
199 ASSERT_TRUE(status.IsOk()); | 242 ASSERT_TRUE(status.IsOk()); |
200 ASSERT_TRUE(capabilities.command.GetSwitches().empty()); | 243 ASSERT_EQ(0u, capabilities.switches.GetSize()); |
201 } | 244 } |
202 | 245 |
203 TEST(ParseCapabilities, PacProxy) { | 246 TEST(ParseCapabilities, PacProxy) { |
204 Capabilities capabilities; | 247 Capabilities capabilities; |
205 base::DictionaryValue proxy; | 248 base::DictionaryValue proxy; |
206 proxy.SetString("proxyType", "PAC"); | 249 proxy.SetString("proxyType", "PAC"); |
207 proxy.SetString("proxyAutoconfigUrl", "test.wpad"); | 250 proxy.SetString("proxyAutoconfigUrl", "test.wpad"); |
208 base::DictionaryValue caps; | 251 base::DictionaryValue caps; |
209 caps.Set("proxy", proxy.DeepCopy()); | 252 caps.Set("proxy", proxy.DeepCopy()); |
210 Logger log(Log::kError); | 253 Logger log(Log::kError); |
211 Status status = capabilities.Parse(caps, &log); | 254 Status status = capabilities.Parse(caps, &log); |
212 ASSERT_TRUE(status.IsOk()); | 255 ASSERT_TRUE(status.IsOk()); |
213 ASSERT_EQ(1u, capabilities.command.GetSwitches().size()); | 256 ASSERT_EQ(1u, capabilities.switches.GetSize()); |
214 ASSERT_STREQ( | 257 ASSERT_EQ("test.wpad", capabilities.switches.GetSwitchValue("proxy-pac-url")); |
215 "test.wpad", | |
216 capabilities.command.GetSwitchValueASCII("proxy-pac-url").c_str()); | |
217 } | 258 } |
218 | 259 |
219 TEST(ParseCapabilities, MissingProxyAutoconfigUrl) { | 260 TEST(ParseCapabilities, MissingProxyAutoconfigUrl) { |
220 Capabilities capabilities; | 261 Capabilities capabilities; |
221 base::DictionaryValue proxy; | 262 base::DictionaryValue proxy; |
222 proxy.SetString("proxyType", "PAC"); | 263 proxy.SetString("proxyType", "PAC"); |
223 proxy.SetString("httpProxy", "http://localhost:8001"); | 264 proxy.SetString("httpProxy", "http://localhost:8001"); |
224 base::DictionaryValue caps; | 265 base::DictionaryValue caps; |
225 caps.Set("proxy", proxy.DeepCopy()); | 266 caps.Set("proxy", proxy.DeepCopy()); |
226 Logger log(Log::kError); | 267 Logger log(Log::kError); |
227 Status status = capabilities.Parse(caps, &log); | 268 Status status = capabilities.Parse(caps, &log); |
228 ASSERT_FALSE(status.IsOk()); | 269 ASSERT_FALSE(status.IsOk()); |
229 } | 270 } |
230 | 271 |
231 TEST(ParseCapabilities, AutodetectProxy) { | 272 TEST(ParseCapabilities, AutodetectProxy) { |
232 Capabilities capabilities; | 273 Capabilities capabilities; |
233 base::DictionaryValue proxy; | 274 base::DictionaryValue proxy; |
234 proxy.SetString("proxyType", "autodetect"); | 275 proxy.SetString("proxyType", "autodetect"); |
235 base::DictionaryValue caps; | 276 base::DictionaryValue caps; |
236 caps.Set("proxy", proxy.DeepCopy()); | 277 caps.Set("proxy", proxy.DeepCopy()); |
237 Logger log(Log::kError); | 278 Logger log(Log::kError); |
238 Status status = capabilities.Parse(caps, &log); | 279 Status status = capabilities.Parse(caps, &log); |
239 ASSERT_TRUE(status.IsOk()); | 280 ASSERT_TRUE(status.IsOk()); |
240 ASSERT_EQ(1u, capabilities.command.GetSwitches().size()); | 281 ASSERT_EQ(1u, capabilities.switches.GetSize()); |
241 ASSERT_TRUE(capabilities.command.HasSwitch("proxy-auto-detect")); | 282 ASSERT_TRUE(capabilities.switches.HasSwitch("proxy-auto-detect")); |
242 } | 283 } |
243 | 284 |
244 TEST(ParseCapabilities, ManualProxy) { | 285 TEST(ParseCapabilities, ManualProxy) { |
245 Capabilities capabilities; | 286 Capabilities capabilities; |
246 base::DictionaryValue proxy; | 287 base::DictionaryValue proxy; |
247 proxy.SetString("proxyType", "manual"); | 288 proxy.SetString("proxyType", "manual"); |
248 proxy.SetString("ftpProxy", "localhost:9001"); | 289 proxy.SetString("ftpProxy", "localhost:9001"); |
249 proxy.SetString("httpProxy", "localhost:8001"); | 290 proxy.SetString("httpProxy", "localhost:8001"); |
250 proxy.SetString("sslProxy", "localhost:10001"); | 291 proxy.SetString("sslProxy", "localhost:10001"); |
251 proxy.SetString("noProxy", "google.com, youtube.com"); | 292 proxy.SetString("noProxy", "google.com, youtube.com"); |
252 base::DictionaryValue caps; | 293 base::DictionaryValue caps; |
253 caps.Set("proxy", proxy.DeepCopy()); | 294 caps.Set("proxy", proxy.DeepCopy()); |
254 Logger log(Log::kError); | 295 Logger log(Log::kError); |
255 Status status = capabilities.Parse(caps, &log); | 296 Status status = capabilities.Parse(caps, &log); |
256 ASSERT_TRUE(status.IsOk()); | 297 ASSERT_TRUE(status.IsOk()); |
257 ASSERT_EQ(2u, capabilities.command.GetSwitches().size()); | 298 ASSERT_EQ(2u, capabilities.switches.GetSize()); |
258 ASSERT_STREQ( | 299 ASSERT_EQ( |
259 "ftp=localhost:9001;http=localhost:8001;https=localhost:10001", | 300 "ftp=localhost:9001;http=localhost:8001;https=localhost:10001", |
260 capabilities.command.GetSwitchValueASCII("proxy-server").c_str()); | 301 capabilities.switches.GetSwitchValue("proxy-server")); |
261 ASSERT_STREQ( | 302 ASSERT_EQ( |
262 "google.com, youtube.com", | 303 "google.com, youtube.com", |
263 capabilities.command.GetSwitchValueASCII("proxy-bypass-list").c_str()); | 304 capabilities.switches.GetSwitchValue("proxy-bypass-list")); |
264 } | 305 } |
265 | 306 |
266 TEST(ParseCapabilities, MissingSettingForManualProxy) { | 307 TEST(ParseCapabilities, MissingSettingForManualProxy) { |
267 Capabilities capabilities; | 308 Capabilities capabilities; |
268 base::DictionaryValue proxy; | 309 base::DictionaryValue proxy; |
269 proxy.SetString("proxyType", "manual"); | 310 proxy.SetString("proxyType", "manual"); |
270 base::DictionaryValue caps; | 311 base::DictionaryValue caps; |
271 caps.Set("proxy", proxy.DeepCopy()); | 312 caps.Set("proxy", proxy.DeepCopy()); |
272 Logger log(Log::kError); | 313 Logger log(Log::kError); |
273 Status status = capabilities.Parse(caps, &log); | 314 Status status = capabilities.Parse(caps, &log); |
274 ASSERT_FALSE(status.IsOk()); | 315 ASSERT_FALSE(status.IsOk()); |
275 } | 316 } |
276 | 317 |
277 TEST(ParseCapabilities, IgnoreNullValueForManualProxy) { | 318 TEST(ParseCapabilities, IgnoreNullValueForManualProxy) { |
278 Capabilities capabilities; | 319 Capabilities capabilities; |
279 base::DictionaryValue proxy; | 320 base::DictionaryValue proxy; |
280 proxy.SetString("proxyType", "manual"); | 321 proxy.SetString("proxyType", "manual"); |
281 proxy.SetString("ftpProxy", "localhost:9001"); | 322 proxy.SetString("ftpProxy", "localhost:9001"); |
282 proxy.Set("sslProxy", base::Value::CreateNullValue()); | 323 proxy.Set("sslProxy", base::Value::CreateNullValue()); |
283 proxy.Set("noProxy", base::Value::CreateNullValue()); | 324 proxy.Set("noProxy", base::Value::CreateNullValue()); |
284 base::DictionaryValue caps; | 325 base::DictionaryValue caps; |
285 caps.Set("proxy", proxy.DeepCopy()); | 326 caps.Set("proxy", proxy.DeepCopy()); |
286 Logger log(Log::kError); | 327 Logger log(Log::kError); |
287 Status status = capabilities.Parse(caps, &log); | 328 Status status = capabilities.Parse(caps, &log); |
288 ASSERT_TRUE(status.IsOk()); | 329 ASSERT_TRUE(status.IsOk()); |
289 ASSERT_EQ(1u, capabilities.command.GetSwitches().size()); | 330 ASSERT_EQ(1u, capabilities.switches.GetSize()); |
290 ASSERT_TRUE(capabilities.command.HasSwitch("proxy-server")); | 331 ASSERT_TRUE(capabilities.switches.HasSwitch("proxy-server")); |
291 ASSERT_STREQ( | 332 ASSERT_EQ( |
292 "ftp=localhost:9001", | 333 "ftp=localhost:9001", |
293 capabilities.command.GetSwitchValueASCII("proxy-server").c_str()); | 334 capabilities.switches.GetSwitchValue("proxy-server")); |
294 } | 335 } |
295 | 336 |
296 TEST(ParseCapabilities, LoggingPrefsOk) { | 337 TEST(ParseCapabilities, LoggingPrefsOk) { |
297 Capabilities capabilities; | 338 Capabilities capabilities; |
298 base::DictionaryValue logging_prefs; | 339 base::DictionaryValue logging_prefs; |
299 logging_prefs.SetString("Network", "INFO"); | 340 logging_prefs.SetString("Network", "INFO"); |
300 base::DictionaryValue caps; | 341 base::DictionaryValue caps; |
301 caps.Set("loggingPrefs", logging_prefs.DeepCopy()); | 342 caps.Set("loggingPrefs", logging_prefs.DeepCopy()); |
302 Logger log(Log::kError); | 343 Logger log(Log::kError); |
303 Status status = capabilities.Parse(caps, &log); | 344 Status status = capabilities.Parse(caps, &log); |
(...skipping 26 matching lines...) Expand all Loading... |
330 ASSERT_TRUE(status.IsOk()); | 371 ASSERT_TRUE(status.IsOk()); |
331 ASSERT_EQ(2u, capabilities.exclude_switches.size()); | 372 ASSERT_EQ(2u, capabilities.exclude_switches.size()); |
332 const std::set<std::string>& switches = capabilities.exclude_switches; | 373 const std::set<std::string>& switches = capabilities.exclude_switches; |
333 ASSERT_TRUE(switches.find("switch1") != switches.end()); | 374 ASSERT_TRUE(switches.find("switch1") != switches.end()); |
334 ASSERT_TRUE(switches.find("switch2") != switches.end()); | 375 ASSERT_TRUE(switches.find("switch2") != switches.end()); |
335 } | 376 } |
336 | 377 |
337 TEST(ParseCapabilities, UseExistingBrowser) { | 378 TEST(ParseCapabilities, UseExistingBrowser) { |
338 Capabilities capabilities; | 379 Capabilities capabilities; |
339 base::DictionaryValue caps; | 380 base::DictionaryValue caps; |
340 caps.SetString("chromeOptions.useExistingBrowser", "abc:123"); | 381 caps.SetString("chromeOptions.debuggerAddress", "abc:123"); |
341 Logger log(Log::kError); | 382 Logger log(Log::kError); |
342 Status status = capabilities.Parse(caps, &log); | 383 Status status = capabilities.Parse(caps, &log); |
343 ASSERT_TRUE(status.IsOk()); | 384 ASSERT_TRUE(status.IsOk()); |
344 ASSERT_TRUE(capabilities.IsExistingBrowser()); | 385 ASSERT_TRUE(capabilities.IsExistingBrowser()); |
345 ASSERT_EQ("abc", capabilities.use_existing_browser.host()); | 386 ASSERT_EQ("abc", capabilities.debugger_address.host()); |
346 ASSERT_EQ(123, capabilities.use_existing_browser.port()); | 387 ASSERT_EQ(123, capabilities.debugger_address.port()); |
347 } | 388 } |
OLD | NEW |