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/status.h" | 8 #include "chrome/test/chromedriver/chrome/status.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 TEST(ParseCapabilities, MissingSettingForManualProxy) { | 246 TEST(ParseCapabilities, MissingSettingForManualProxy) { |
247 Capabilities capabilities; | 247 Capabilities capabilities; |
248 base::DictionaryValue proxy; | 248 base::DictionaryValue proxy; |
249 proxy.SetString("proxyType", "manual"); | 249 proxy.SetString("proxyType", "manual"); |
250 base::DictionaryValue caps; | 250 base::DictionaryValue caps; |
251 caps.Set("proxy", proxy.DeepCopy()); | 251 caps.Set("proxy", proxy.DeepCopy()); |
252 Status status = capabilities.Parse(caps); | 252 Status status = capabilities.Parse(caps); |
253 ASSERT_FALSE(status.IsOk()); | 253 ASSERT_FALSE(status.IsOk()); |
254 } | 254 } |
| 255 |
| 256 TEST(ParseCapabilities, LoggingPrefsOk) { |
| 257 Capabilities capabilities; |
| 258 base::DictionaryValue logging_prefs; |
| 259 logging_prefs.SetString("Network", "INFO"); |
| 260 base::DictionaryValue caps; |
| 261 caps.Set("loggingPrefs", logging_prefs.DeepCopy()); |
| 262 Status status = capabilities.Parse(caps); |
| 263 ASSERT_TRUE(status.IsOk()); |
| 264 ASSERT_TRUE(capabilities.logging_prefs.get()); |
| 265 ASSERT_EQ(1u, capabilities.logging_prefs->size()); |
| 266 std::string log_level; |
| 267 ASSERT_TRUE(capabilities.logging_prefs->GetString("Network", &log_level)); |
| 268 ASSERT_STREQ("INFO", log_level.c_str()); |
| 269 } |
| 270 |
| 271 TEST(ParseCapabilities, LoggingPrefsNotDict) { |
| 272 Capabilities capabilities; |
| 273 base::DictionaryValue caps; |
| 274 caps.SetString("loggingPrefs", "INFO"); |
| 275 Status status = capabilities.Parse(caps); |
| 276 ASSERT_FALSE(status.IsOk()); |
| 277 } |
| 278 |
OLD | NEW |