| 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/memory/ptr_util.h" |
| 7 #include "base/values.h" | 8 #include "base/values.h" |
| 8 #include "chrome/test/chromedriver/chrome/log.h" | 9 #include "chrome/test/chromedriver/chrome/log.h" |
| 9 #include "chrome/test/chromedriver/chrome/status.h" | 10 #include "chrome/test/chromedriver/chrome/status.h" |
| 10 #include "chrome/test/chromedriver/logging.h" | 11 #include "chrome/test/chromedriver/logging.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 TEST(Switches, Empty) { | 14 TEST(Switches, Empty) { |
| 14 Switches switches; | 15 Switches switches; |
| 15 base::CommandLine cmd(base::CommandLine::NO_PROGRAM); | 16 base::CommandLine cmd(base::CommandLine::NO_PROGRAM); |
| 16 switches.AppendToCommandLine(&cmd); | 17 switches.AppendToCommandLine(&cmd); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 caps.Set("proxy", proxy.DeepCopy()); | 298 caps.Set("proxy", proxy.DeepCopy()); |
| 298 Status status = capabilities.Parse(caps); | 299 Status status = capabilities.Parse(caps); |
| 299 ASSERT_FALSE(status.IsOk()); | 300 ASSERT_FALSE(status.IsOk()); |
| 300 } | 301 } |
| 301 | 302 |
| 302 TEST(ParseCapabilities, IgnoreNullValueForManualProxy) { | 303 TEST(ParseCapabilities, IgnoreNullValueForManualProxy) { |
| 303 Capabilities capabilities; | 304 Capabilities capabilities; |
| 304 base::DictionaryValue proxy; | 305 base::DictionaryValue proxy; |
| 305 proxy.SetString("proxyType", "manual"); | 306 proxy.SetString("proxyType", "manual"); |
| 306 proxy.SetString("ftpProxy", "localhost:9001"); | 307 proxy.SetString("ftpProxy", "localhost:9001"); |
| 307 proxy.Set("sslProxy", base::Value::CreateNullValue()); | 308 proxy.Set("sslProxy", base::MakeUnique<base::Value>()); |
| 308 proxy.Set("noProxy", base::Value::CreateNullValue()); | 309 proxy.Set("noProxy", base::MakeUnique<base::Value>()); |
| 309 base::DictionaryValue caps; | 310 base::DictionaryValue caps; |
| 310 caps.Set("proxy", proxy.DeepCopy()); | 311 caps.Set("proxy", proxy.DeepCopy()); |
| 311 Status status = capabilities.Parse(caps); | 312 Status status = capabilities.Parse(caps); |
| 312 ASSERT_TRUE(status.IsOk()); | 313 ASSERT_TRUE(status.IsOk()); |
| 313 ASSERT_EQ(1u, capabilities.switches.GetSize()); | 314 ASSERT_EQ(1u, capabilities.switches.GetSize()); |
| 314 ASSERT_TRUE(capabilities.switches.HasSwitch("proxy-server")); | 315 ASSERT_TRUE(capabilities.switches.HasSwitch("proxy-server")); |
| 315 ASSERT_EQ( | 316 ASSERT_EQ( |
| 316 "ftp=localhost:9001", | 317 "ftp=localhost:9001", |
| 317 capabilities.switches.GetSwitchValue("proxy-server")); | 318 capabilities.switches.GetSwitchValue("proxy-server")); |
| 318 } | 319 } |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 base::DictionaryValue mobile_emulation; | 556 base::DictionaryValue mobile_emulation; |
| 556 mobile_emulation.SetString("deviceName", "Google Nexus 5"); | 557 mobile_emulation.SetString("deviceName", "Google Nexus 5"); |
| 557 mobile_emulation.SetInteger("deviceMetrics.width", 360); | 558 mobile_emulation.SetInteger("deviceMetrics.width", 360); |
| 558 mobile_emulation.SetInteger("deviceMetrics.height", 640); | 559 mobile_emulation.SetInteger("deviceMetrics.height", 640); |
| 559 mobile_emulation.SetDouble("deviceMetrics.pixelRatio", 3.0); | 560 mobile_emulation.SetDouble("deviceMetrics.pixelRatio", 3.0); |
| 560 base::DictionaryValue caps; | 561 base::DictionaryValue caps; |
| 561 caps.Set("chromeOptions.mobileEmulation", mobile_emulation.DeepCopy()); | 562 caps.Set("chromeOptions.mobileEmulation", mobile_emulation.DeepCopy()); |
| 562 Status status = capabilities.Parse(caps); | 563 Status status = capabilities.Parse(caps); |
| 563 ASSERT_FALSE(status.IsOk()); | 564 ASSERT_FALSE(status.IsOk()); |
| 564 } | 565 } |
| OLD | NEW |