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