| 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 "chrome/browser/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/common/chrome_version_info.h" | 10 #include "chrome/common/chrome_version_info.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class TestChromePasswordManagerClient : public ChromePasswordManagerClient { | 38 class TestChromePasswordManagerClient : public ChromePasswordManagerClient { |
| 39 public: | 39 public: |
| 40 explicit TestChromePasswordManagerClient(content::WebContents* web_contents) | 40 explicit TestChromePasswordManagerClient(content::WebContents* web_contents) |
| 41 : ChromePasswordManagerClient(web_contents, NULL), | 41 : ChromePasswordManagerClient(web_contents, NULL), |
| 42 is_sync_account_credential_(false) {} | 42 is_sync_account_credential_(false) {} |
| 43 virtual ~TestChromePasswordManagerClient() {} | 43 virtual ~TestChromePasswordManagerClient() {} |
| 44 | 44 |
| 45 virtual bool IsSyncAccountCredential( | 45 virtual bool IsSyncAccountCredential( |
| 46 const std::string& username, | 46 const std::string& username, |
| 47 const std::string& origin) const OVERRIDE { | 47 const std::string& origin) const override { |
| 48 return is_sync_account_credential_; | 48 return is_sync_account_credential_; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void set_is_sync_account_credential(bool is_sync_account_credential) { | 51 void set_is_sync_account_credential(bool is_sync_account_credential) { |
| 52 is_sync_account_credential_ = is_sync_account_credential; | 52 is_sync_account_credential_ = is_sync_account_credential; |
| 53 } | 53 } |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 bool is_sync_account_credential_; | 56 bool is_sync_account_credential_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(TestChromePasswordManagerClient); | 58 DISALLOW_COPY_AND_ASSIGN(TestChromePasswordManagerClient); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 class ChromePasswordManagerClientTest : public ChromeRenderViewHostTestHarness { | 63 class ChromePasswordManagerClientTest : public ChromeRenderViewHostTestHarness { |
| 64 public: | 64 public: |
| 65 ChromePasswordManagerClientTest(); | 65 ChromePasswordManagerClientTest(); |
| 66 | 66 |
| 67 virtual void SetUp() OVERRIDE; | 67 virtual void SetUp() override; |
| 68 | 68 |
| 69 protected: | 69 protected: |
| 70 ChromePasswordManagerClient* GetClient(); | 70 ChromePasswordManagerClient* GetClient(); |
| 71 | 71 |
| 72 // If the test IPC sink contains an AutofillMsg_SetLoggingState message, then | 72 // If the test IPC sink contains an AutofillMsg_SetLoggingState message, then |
| 73 // copies its argument into |activation_flag| and returns true. Otherwise | 73 // copies its argument into |activation_flag| and returns true. Otherwise |
| 74 // returns false. | 74 // returns false. |
| 75 bool WasLoggingActivationMessageSent(bool* activation_flag); | 75 bool WasLoggingActivationMessageSent(bool* activation_flag); |
| 76 | 76 |
| 77 password_manager::PasswordManagerInternalsService* service_; | 77 password_manager::PasswordManagerInternalsService* service_; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 GURL("https://accounts.google.com/ServiceLogin?continue=" | 323 GURL("https://accounts.google.com/ServiceLogin?continue=" |
| 324 "https://mail.google.com&rart=234")); | 324 "https://mail.google.com&rart=234")); |
| 325 EXPECT_TRUE(client->IsPasswordManagerEnabledForCurrentPage()); | 325 EXPECT_TRUE(client->IsPasswordManagerEnabledForCurrentPage()); |
| 326 | 326 |
| 327 // Reauth pages are only on accounts.google.com | 327 // Reauth pages are only on accounts.google.com |
| 328 NavigateAndCommit( | 328 NavigateAndCommit( |
| 329 GURL("https://other.site.com/ServiceLogin?continue=" | 329 GURL("https://other.site.com/ServiceLogin?continue=" |
| 330 "https://passwords.google.com&rart=234")); | 330 "https://passwords.google.com&rart=234")); |
| 331 EXPECT_TRUE(client->IsPasswordManagerEnabledForCurrentPage()); | 331 EXPECT_TRUE(client->IsPasswordManagerEnabledForCurrentPage()); |
| 332 } | 332 } |
| OLD | NEW |