| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/autofill/core/common/save_password_progress_logger.h" | 5 #include "components/autofill/core/common/save_password_progress_logger.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 EXPECT_FALSE(logger.LogsContainSubstring(kIPAddressInside)); | 79 EXPECT_FALSE(logger.LogsContainSubstring(kIPAddressInside)); |
| 80 EXPECT_TRUE(logger.LogsContainSubstring(kIPAddressInsideExpected)); | 80 EXPECT_TRUE(logger.LogsContainSubstring(kIPAddressInsideExpected)); |
| 81 EXPECT_FALSE(logger.LogsContainSubstring(kSpecialCharsInside)); | 81 EXPECT_FALSE(logger.LogsContainSubstring(kSpecialCharsInside)); |
| 82 EXPECT_TRUE(logger.LogsContainSubstring(kSpecialCharsInsideExpected)); | 82 EXPECT_TRUE(logger.LogsContainSubstring(kSpecialCharsInsideExpected)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 TEST(SavePasswordProgressLoggerTest, LogHTMLForm) { | 85 TEST(SavePasswordProgressLoggerTest, LogHTMLForm) { |
| 86 TestLogger logger; | 86 TestLogger logger; |
| 87 logger.LogHTMLForm(SavePasswordProgressLogger::STRING_MESSAGE, | 87 logger.LogHTMLForm(SavePasswordProgressLogger::STRING_MESSAGE, |
| 88 "form_name", | 88 "form_name", |
| 89 "post", | |
| 90 GURL("http://example.org/verysecret?verysecret")); | 89 GURL("http://example.org/verysecret?verysecret")); |
| 91 SCOPED_TRACE(testing::Message() << "Log string = [" | 90 SCOPED_TRACE(testing::Message() << "Log string = [" |
| 92 << logger.accumulated_log() << "]"); | 91 << logger.accumulated_log() << "]"); |
| 93 EXPECT_TRUE(logger.LogsContainSubstring(kTestString)); | 92 EXPECT_TRUE(logger.LogsContainSubstring(kTestString)); |
| 94 EXPECT_TRUE(logger.LogsContainSubstring("form_name")); | 93 EXPECT_TRUE(logger.LogsContainSubstring("form_name")); |
| 95 EXPECT_TRUE(logger.LogsContainSubstring("POST")); | |
| 96 EXPECT_TRUE(logger.LogsContainSubstring("http://example.org")); | 94 EXPECT_TRUE(logger.LogsContainSubstring("http://example.org")); |
| 97 EXPECT_FALSE(logger.LogsContainSubstring("verysecret")); | 95 EXPECT_FALSE(logger.LogsContainSubstring("verysecret")); |
| 98 } | 96 } |
| 99 | 97 |
| 100 TEST(SavePasswordProgressLoggerTest, LogURL) { | 98 TEST(SavePasswordProgressLoggerTest, LogURL) { |
| 101 TestLogger logger; | 99 TestLogger logger; |
| 102 logger.LogURL(SavePasswordProgressLogger::STRING_MESSAGE, | 100 logger.LogURL(SavePasswordProgressLogger::STRING_MESSAGE, |
| 103 GURL("http://example.org/verysecret?verysecret")); | 101 GURL("http://example.org/verysecret?verysecret")); |
| 104 SCOPED_TRACE(testing::Message() << "Log string = [" | 102 SCOPED_TRACE(testing::Message() << "Log string = [" |
| 105 << logger.accumulated_log() << "]"); | 103 << logger.accumulated_log() << "]"); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 146 |
| 149 TEST(SavePasswordProgressLoggerTest, LogMessage) { | 147 TEST(SavePasswordProgressLoggerTest, LogMessage) { |
| 150 TestLogger logger; | 148 TestLogger logger; |
| 151 logger.LogMessage(SavePasswordProgressLogger::STRING_MESSAGE); | 149 logger.LogMessage(SavePasswordProgressLogger::STRING_MESSAGE); |
| 152 SCOPED_TRACE(testing::Message() << "Log string = [" | 150 SCOPED_TRACE(testing::Message() << "Log string = [" |
| 153 << logger.accumulated_log() << "]"); | 151 << logger.accumulated_log() << "]"); |
| 154 EXPECT_TRUE(logger.LogsContainSubstring(kTestString)); | 152 EXPECT_TRUE(logger.LogsContainSubstring(kTestString)); |
| 155 } | 153 } |
| 156 | 154 |
| 157 } // namespace autofill | 155 } // namespace autofill |
| OLD | NEW |