Chromium Code Reviews| Index: chrome/test/chromedriver/chrome/console_logger_unittest.cc |
| diff --git a/chrome/test/chromedriver/chrome/console_logger_unittest.cc b/chrome/test/chromedriver/chrome/console_logger_unittest.cc |
| index deae61b0538db0e9cb486668d15183f4958e25b8..bde0c03a1e78ff3b6ced8e4b3d110396ba9df323 100644 |
| --- a/chrome/test/chromedriver/chrome/console_logger_unittest.cc |
| +++ b/chrome/test/chromedriver/chrome/console_logger_unittest.cc |
| @@ -88,11 +88,11 @@ void FakeLog::AddEntry( |
| } |
| void ValidateLogEntry(LogEntry *entry, |
| - Log::Level expect_level, |
| - const char* expect_message) { |
| - EXPECT_EQ(expect_level, entry->level); |
| + Log::Level expected_level, |
| + const char* expected_message) { |
| + EXPECT_EQ(expected_level, entry->level); |
| EXPECT_LT(0, entry->timestamp.ToTimeT()); |
| - EXPECT_STREQ(expect_message, entry->message.c_str()); |
| + EXPECT_EQ(expected_message, entry->message); |
| } |
| void ConsoleLogParams(base::DictionaryValue* out_params, |
| @@ -102,17 +102,17 @@ void ConsoleLogParams(base::DictionaryValue* out_params, |
| int line, |
| int column, |
| const char* text) { |
| - if (NULL != source) |
| + if (source != NULL) |
| out_params->SetString("message.source", source); |
| - if (NULL != url) |
| + if (url != NULL) |
| out_params->SetString("message.url", url); |
| - if (NULL != level) |
| + if (level != NULL) |
| out_params->SetString("message.level", level); |
| - if (-1 != line) |
| + if (line != -1) |
| out_params->SetInteger("message.line", line); |
| - if (-1 != column) |
| + if (column != -1) |
| out_params->SetInteger("message.column", column); |
| - if (NULL != text) |
| + if (text != NULL) |
| out_params->SetString("message.text", text); |
| } |
| @@ -125,8 +125,8 @@ TEST(ConsoleLogger, ConsoleMessages) { |
| client.AddListener(&logger); |
| logger.OnConnected(&client); |
| - EXPECT_STREQ("Console.enable", client.PopSentCommand().c_str()); |
| - EXPECT_STREQ("", client.PopSentCommand().c_str()); |
| + EXPECT_EQ("Console.enable", client.PopSentCommand()); |
| + EXPECT_TRUE(client.PopSentCommand().empty()); |
|
jdennett
2013/05/23 03:44:24
Optional: if you can use GMock, you can also write
klm
2013/05/23 15:21:39
Looks like gmock matchers are generally allowed, b
|
| base::DictionaryValue params1; // All fields are set. |
| ConsoleLogParams(¶ms1, "source1", "url1", "debug", 10, 1, "text1"); |
|
jdennett
2013/05/23 03:44:24
Comment what 10 and 1 mean here. See https://www.
klm
2013/05/23 15:21:39
The style guide says "consider", not "always do".
|
| @@ -161,7 +161,7 @@ TEST(ConsoleLogger, ConsoleMessages) { |
| params8.SetInteger("gaga", 8); |
| client.TriggerEvent("Console.messageAdded", params8); |
| - EXPECT_STREQ("", client.PopSentCommand().c_str()); // No other commands sent. |
| + EXPECT_TRUE(client.PopSentCommand().empty()); // No other commands sent. |
| ASSERT_EQ(8u, log.entries.size()); |
| ValidateLogEntry(log.entries[0], Log::kDebug, "url1 10:1 text1"); |