| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/base64.h" | 5 #include "base/base64.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/common/zip.h" | 11 #include "chrome/common/zip.h" |
| 12 #include "chrome/test/webdriver/webdriver_capabilities_parser.h" | 12 #include "chrome/test/webdriver/webdriver_capabilities_parser.h" |
| 13 #include "chrome/test/webdriver/webdriver_logging.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 using base::DictionaryValue; | 16 using base::DictionaryValue; |
| 16 using base::ListValue; | 17 using base::ListValue; |
| 17 using base::Value; | 18 using base::Value; |
| 18 | 19 |
| 19 namespace webdriver { | 20 namespace webdriver { |
| 20 | 21 |
| 21 TEST(CapabilitiesParser, NoCaps) { | 22 TEST(CapabilitiesParser, NoCaps) { |
| 22 Capabilities caps; | 23 Capabilities caps; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 options->SetString("proxyType", "manual"); | 253 options->SetString("proxyType", "manual"); |
| 253 options->SetString("httpProxy", "localhost:8001"); | 254 options->SetString("httpProxy", "localhost:8001"); |
| 254 options->Set("ftpProxy", Value::CreateNullValue()); | 255 options->Set("ftpProxy", Value::CreateNullValue()); |
| 255 | 256 |
| 256 CapabilitiesParser parser(&dict, FilePath(), Logger(), &caps); | 257 CapabilitiesParser parser(&dict, FilePath(), Logger(), &caps); |
| 257 ASSERT_FALSE(parser.Parse()); | 258 ASSERT_FALSE(parser.Parse()); |
| 258 EXPECT_STREQ("http=localhost:8001", | 259 EXPECT_STREQ("http=localhost:8001", |
| 259 caps.command.GetSwitchValueASCII(switches::kProxyServer).c_str()); | 260 caps.command.GetSwitchValueASCII(switches::kProxyServer).c_str()); |
| 260 } | 261 } |
| 261 | 262 |
| 263 TEST(CapabilitiesParser, DriverLoggingCapString) { |
| 264 Capabilities caps; |
| 265 DictionaryValue dict; |
| 266 DictionaryValue* options = new DictionaryValue(); |
| 267 dict.Set("loggingPrefs", options); |
| 268 CapabilitiesParser parser(&dict, FilePath(), Logger(), &caps); |
| 269 |
| 270 // A string as the driver logging level works. |
| 271 options->SetString("driver", "INFO"); |
| 272 ASSERT_FALSE(parser.Parse()); |
| 273 |
| 274 // An integer (here, an enum LogLevel value) doesn't work. |
| 275 options->SetInteger("driver", kInfoLogLevel); |
| 276 ASSERT_TRUE(parser.Parse()); |
| 277 } |
| 278 |
| 262 } // namespace webdriver | 279 } // namespace webdriver |
| OLD | NEW |