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/chrome/console_logger.h" | 5 #include "chrome/test/chromedriver/chrome/console_logger.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 ASSERT_EQ(kOk, client.TriggerEvent("Console.messageAdded", params7).code()); | 166 ASSERT_EQ(kOk, client.TriggerEvent("Console.messageAdded", params7).code()); |
167 | 167 |
168 base::DictionaryValue params8; // No message object. | 168 base::DictionaryValue params8; // No message object. |
169 params8.SetInteger("gaga", 8); | 169 params8.SetInteger("gaga", 8); |
170 ASSERT_EQ(kOk, client.TriggerEvent("Console.messageAdded", params8).code()); | 170 ASSERT_EQ(kOk, client.TriggerEvent("Console.messageAdded", params8).code()); |
171 | 171 |
172 EXPECT_TRUE(client.PopSentCommand().empty()); // No other commands sent. | 172 EXPECT_TRUE(client.PopSentCommand().empty()); // No other commands sent. |
173 | 173 |
174 ASSERT_EQ(8u, log.GetEntries().size()); | 174 ASSERT_EQ(8u, log.GetEntries().size()); |
175 ValidateLogEntry(log.GetEntries()[0], Log::kDebug, "url1 10:1 text1"); | 175 ValidateLogEntry(log.GetEntries()[0], Log::kDebug, "url1 10:1 text1"); |
176 ValidateLogEntry(log.GetEntries()[1], Log::kLog, "source2 - text2"); | 176 ValidateLogEntry(log.GetEntries()[1], Log::kInfo, "source2 - text2"); |
177 ValidateLogEntry(log.GetEntries()[2], Log::kWarning, "url3 30 text3"); | 177 ValidateLogEntry(log.GetEntries()[2], Log::kWarning, "url3 30 text3"); |
178 ValidateLogEntry(log.GetEntries()[3], Log::kError, "url4 - text4"); | 178 ValidateLogEntry(log.GetEntries()[3], Log::kError, "url4 - text4"); |
179 ValidateLogEntry( | 179 ValidateLogEntry( |
180 log.GetEntries()[4], Log::kWarning, | 180 log.GetEntries()[4], Log::kWarning, |
181 "{\"message\":{\"column\":5,\"level\":\"gaga\",\"line\":50," | 181 "{\"message\":{\"column\":5,\"level\":\"gaga\",\"line\":50," |
182 "\"source\":\"source5\",\"text\":\"ulala\",\"url\":\"url5\"}}"); | 182 "\"source\":\"source5\",\"text\":\"ulala\",\"url\":\"url5\"}}"); |
183 ValidateLogEntry( | 183 ValidateLogEntry( |
184 log.GetEntries()[5], Log::kWarning, | 184 log.GetEntries()[5], Log::kWarning, |
185 "{\"message\":{\"column\":6,\"line\":60," | 185 "{\"message\":{\"column\":6,\"line\":60," |
186 "\"source\":\"source6\",\"url\":\"url6\"}}"); | 186 "\"source\":\"source6\",\"url\":\"url6\"}}"); |
187 ValidateLogEntry( | 187 ValidateLogEntry( |
188 log.GetEntries()[6], Log::kWarning, | 188 log.GetEntries()[6], Log::kWarning, |
189 "{\"message\":{\"level\":\"log\"," | 189 "{\"message\":{\"level\":\"log\"," |
190 "\"source\":\"source7\",\"url\":\"url7\"}}"); | 190 "\"source\":\"source7\",\"url\":\"url7\"}}"); |
191 ValidateLogEntry(log.GetEntries()[7], Log::kWarning, "{\"gaga\":8}"); | 191 ValidateLogEntry(log.GetEntries()[7], Log::kWarning, "{\"gaga\":8}"); |
192 } | 192 } |
OLD | NEW |