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 "chrome/test/chromedriver/logging.h" | 10 #include "chrome/test/chromedriver/logging.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 Capabilities capabilities; | 341 Capabilities capabilities; |
342 // Perf log must be enabled if performance log preferences are specified. | 342 // Perf log must be enabled if performance log preferences are specified. |
343 base::DictionaryValue logging_prefs; | 343 base::DictionaryValue logging_prefs; |
344 logging_prefs.SetString(WebDriverLog::kPerformanceType, "INFO"); | 344 logging_prefs.SetString(WebDriverLog::kPerformanceType, "INFO"); |
345 base::DictionaryValue desired_caps; | 345 base::DictionaryValue desired_caps; |
346 desired_caps.Set("loggingPrefs", logging_prefs.DeepCopy()); | 346 desired_caps.Set("loggingPrefs", logging_prefs.DeepCopy()); |
347 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kDefaultEnabled, | 347 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kDefaultEnabled, |
348 capabilities.perf_logging_prefs.network); | 348 capabilities.perf_logging_prefs.network); |
349 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kDefaultEnabled, | 349 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kDefaultEnabled, |
350 capabilities.perf_logging_prefs.page); | 350 capabilities.perf_logging_prefs.page); |
351 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kDefaultEnabled, | 351 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kDefaultDisabled, |
352 capabilities.perf_logging_prefs.timeline); | 352 capabilities.perf_logging_prefs.timeline); |
353 base::DictionaryValue perf_logging_prefs; | 353 base::DictionaryValue perf_logging_prefs; |
354 perf_logging_prefs.SetBoolean("enableNetwork", true); | 354 perf_logging_prefs.SetBoolean("enableNetwork", true); |
355 perf_logging_prefs.SetBoolean("enablePage", false); | 355 perf_logging_prefs.SetBoolean("enablePage", false); |
356 desired_caps.Set("chromeOptions.perfLoggingPrefs", | 356 desired_caps.Set("chromeOptions.perfLoggingPrefs", |
357 perf_logging_prefs.DeepCopy()); | 357 perf_logging_prefs.DeepCopy()); |
358 Status status = capabilities.Parse(desired_caps); | 358 Status status = capabilities.Parse(desired_caps); |
359 ASSERT_TRUE(status.IsOk()); | 359 ASSERT_TRUE(status.IsOk()); |
360 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kExplicitlyEnabled, | 360 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kExplicitlyEnabled, |
361 capabilities.perf_logging_prefs.network); | 361 capabilities.perf_logging_prefs.network); |
362 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kExplicitlyDisabled, | 362 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kExplicitlyDisabled, |
363 capabilities.perf_logging_prefs.page); | 363 capabilities.perf_logging_prefs.page); |
364 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kDefaultEnabled, | 364 ASSERT_EQ(PerfLoggingPrefs::InspectorDomainStatus::kDefaultDisabled, |
365 capabilities.perf_logging_prefs.timeline); | 365 capabilities.perf_logging_prefs.timeline); |
366 } | 366 } |
367 | 367 |
368 TEST(ParseCapabilities, PerfLoggingPrefsTracing) { | 368 TEST(ParseCapabilities, PerfLoggingPrefsTracing) { |
369 Capabilities capabilities; | 369 Capabilities capabilities; |
370 // Perf log must be enabled if performance log preferences are specified. | 370 // Perf log must be enabled if performance log preferences are specified. |
371 base::DictionaryValue logging_prefs; | 371 base::DictionaryValue logging_prefs; |
372 logging_prefs.SetString(WebDriverLog::kPerformanceType, "INFO"); | 372 logging_prefs.SetString(WebDriverLog::kPerformanceType, "INFO"); |
373 base::DictionaryValue desired_caps; | 373 base::DictionaryValue desired_caps; |
374 desired_caps.Set("loggingPrefs", logging_prefs.DeepCopy()); | 374 desired_caps.Set("loggingPrefs", logging_prefs.DeepCopy()); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 base::DictionaryValue mobile_emulation; | 555 base::DictionaryValue mobile_emulation; |
556 mobile_emulation.SetString("deviceName", "Google Nexus 5"); | 556 mobile_emulation.SetString("deviceName", "Google Nexus 5"); |
557 mobile_emulation.SetInteger("deviceMetrics.width", 360); | 557 mobile_emulation.SetInteger("deviceMetrics.width", 360); |
558 mobile_emulation.SetInteger("deviceMetrics.height", 640); | 558 mobile_emulation.SetInteger("deviceMetrics.height", 640); |
559 mobile_emulation.SetDouble("deviceMetrics.pixelRatio", 3.0); | 559 mobile_emulation.SetDouble("deviceMetrics.pixelRatio", 3.0); |
560 base::DictionaryValue caps; | 560 base::DictionaryValue caps; |
561 caps.Set("chromeOptions.mobileEmulation", mobile_emulation.DeepCopy()); | 561 caps.Set("chromeOptions.mobileEmulation", mobile_emulation.DeepCopy()); |
562 Status status = capabilities.Parse(caps); | 562 Status status = capabilities.Parse(caps); |
563 ASSERT_FALSE(status.IsOk()); | 563 ASSERT_FALSE(status.IsOk()); |
564 } | 564 } |
OLD | NEW |