| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 | 6 |
| 7 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 7 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 8 | 8 |
| 9 #include "chrome/common/chrome_version_info.h" | 9 #include "chrome/common/chrome_version_info.h" |
| 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
| 12 #include "components/autofill/content/common/autofill_messages.h" | 12 #include "components/autofill/content/common/autofill_messages.h" |
| 13 #include "components/password_manager/content/browser/password_manager_internals
_service_factory.h" | 13 #include "components/password_manager/content/browser/password_manager_internals
_service_factory.h" |
| 14 #include "components/password_manager/core/browser/log_receiver.h" |
| 14 #include "components/password_manager/core/browser/password_manager_internals_se
rvice.h" | 15 #include "components/password_manager/core/browser/password_manager_internals_se
rvice.h" |
| 15 #include "components/password_manager/core/browser/password_manager_logger.h" | |
| 16 #include "components/password_manager/core/common/password_manager_switches.h" | 16 #include "components/password_manager/core/common/password_manager_switches.h" |
| 17 #include "content/public/browser/browser_context.h" | 17 #include "content/public/browser/browser_context.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/test/mock_render_process_host.h" | 19 #include "content/public/test/mock_render_process_host.h" |
| 20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 using content::BrowserContext; | 23 using content::BrowserContext; |
| 24 using content::WebContents; | 24 using content::WebContents; |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const char kTestText[] = "abcd1234"; | 28 const char kTestText[] = "abcd1234"; |
| 29 | 29 |
| 30 class MockLogReceiver : public password_manager::PasswordManagerLogger { | 30 class MockLogReceiver : public password_manager::LogReceiver { |
| 31 public: | 31 public: |
| 32 MOCK_METHOD1(LogSavePasswordProgress, void(const std::string&)); | 32 MOCK_METHOD1(LogSavePasswordProgress, void(const std::string&)); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 class ChromePasswordManagerClientTest : public ChromeRenderViewHostTestHarness { | 37 class ChromePasswordManagerClientTest : public ChromeRenderViewHostTestHarness { |
| 38 public: | 38 public: |
| 39 ChromePasswordManagerClientTest(); | 39 ChromePasswordManagerClientTest(); |
| 40 | 40 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 ChromePasswordManagerClient* client = GetClient(); | 156 ChromePasswordManagerClient* client = GetClient(); |
| 157 service_->RegisterReceiver(&receiver_); | 157 service_->RegisterReceiver(&receiver_); |
| 158 EXPECT_TRUE(client->IsLoggingActive()); | 158 EXPECT_TRUE(client->IsLoggingActive()); |
| 159 | 159 |
| 160 EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText)).Times(1); | 160 EXPECT_CALL(receiver_, LogSavePasswordProgress(kTestText)).Times(1); |
| 161 client->LogSavePasswordProgress(kTestText); | 161 client->LogSavePasswordProgress(kTestText); |
| 162 | 162 |
| 163 service_->UnregisterReceiver(&receiver_); | 163 service_->UnregisterReceiver(&receiver_); |
| 164 EXPECT_FALSE(client->IsLoggingActive()); | 164 EXPECT_FALSE(client->IsLoggingActive()); |
| 165 } | 165 } |
| OLD | NEW |