OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/test/chromedriver/logging.h" |
| 6 |
| 7 #include "base/values.h" |
| 8 #include "chrome/test/chromedriver/capabilities.h" |
| 9 #include "chrome/test/chromedriver/chrome/devtools_event_logger.h" |
| 10 #include "chrome/test/chromedriver/chrome/status.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 TEST(Logging, CreatePerformanceLogger) { |
| 14 Capabilities capabilities; |
| 15 capabilities.logging_prefs.reset(new base::DictionaryValue()); |
| 16 capabilities.logging_prefs->SetString("performance", "INFO"); |
| 17 |
| 18 ScopedVector<DevToolsEventLogger> loggers; |
| 19 Status status = CreateLoggers(capabilities, &loggers); |
| 20 ASSERT_TRUE(status.IsOk()); |
| 21 ASSERT_EQ(1u, loggers.size()); |
| 22 ASSERT_STREQ("performance", loggers[0]->GetLogType().c_str()); |
| 23 } |
| 24 |
| 25 TEST(Logging, InvalidLogType) { |
| 26 Capabilities capabilities; |
| 27 capabilities.logging_prefs.reset(new base::DictionaryValue()); |
| 28 capabilities.logging_prefs->SetString("gaga", "INFO"); |
| 29 |
| 30 ScopedVector<DevToolsEventLogger> loggers; |
| 31 Status status = CreateLoggers(capabilities, &loggers); |
| 32 EXPECT_FALSE(status.IsOk()); |
| 33 ASSERT_EQ(0u, loggers.size()); |
| 34 } |
OLD | NEW |