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 "base/values.h" | 5 #include "base/values.h" |
6 #include "chrome/test/chromedriver/capabilities.h" | 6 #include "chrome/test/chromedriver/capabilities.h" |
7 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h" | 7 #include "chrome/test/chromedriver/chrome/devtools_event_listener.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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 Capabilities capabilities; | 128 Capabilities capabilities; |
129 | 129 |
130 ScopedVector<DevToolsEventListener> listeners; | 130 ScopedVector<DevToolsEventListener> listeners; |
131 ScopedVector<WebDriverLog> logs; | 131 ScopedVector<WebDriverLog> logs; |
132 Status status = CreateLogs(capabilities, &logs, &listeners); | 132 Status status = CreateLogs(capabilities, &logs, &listeners); |
133 EXPECT_TRUE(status.IsOk()); | 133 EXPECT_TRUE(status.IsOk()); |
134 ASSERT_EQ(1u, logs.size()); | 134 ASSERT_EQ(1u, logs.size()); |
135 ASSERT_EQ(1u, listeners.size()); | 135 ASSERT_EQ(1u, listeners.size()); |
136 ASSERT_EQ("browser", logs[0]->type()); | 136 ASSERT_EQ("browser", logs[0]->type()); |
137 } | 137 } |
| 138 |
| 139 TEST(Logging, GetFirstErrorMessage) { |
| 140 WebDriverLog log(WebDriverLog::kBrowserType, Log::kAll); |
| 141 std::string entry; |
| 142 |
| 143 entry = log.GetFirstErrorMessage(); |
| 144 ASSERT_TRUE(entry.empty()); |
| 145 |
| 146 log.AddEntry(Log::kInfo, "info message"); |
| 147 log.AddEntry(Log::kError, "first error message"); |
| 148 log.AddEntry(Log::kDebug, "debug message"); |
| 149 log.AddEntry(Log::kError, "second error message"); |
| 150 |
| 151 entry = log.GetFirstErrorMessage(); |
| 152 ASSERT_EQ("first error message", entry); |
| 153 } |
OLD | NEW |