Chromium Code Reviews| 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" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 | 259 |
| 260 // Adding disallow switch should cause sync credential to be filtered. | 260 // Adding disallow switch should cause sync credential to be filtered. |
| 261 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 261 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 262 command_line->AppendSwitch( | 262 command_line->AppendSwitch( |
| 263 password_manager::switches::kDisallowAutofillSyncCredential); | 263 password_manager::switches::kDisallowAutofillSyncCredential); |
| 264 client.reset(new TestChromePasswordManagerClient(web_contents())); | 264 client.reset(new TestChromePasswordManagerClient(web_contents())); |
| 265 client->set_is_sync_account_credential(true); | 265 client->set_is_sync_account_credential(true); |
| 266 NavigateAndCommit(GURL("https://accounts.google.com/Login")); | 266 NavigateAndCommit(GURL("https://accounts.google.com/Login")); |
| 267 EXPECT_TRUE(client->ShouldFilterAutofillResult(form)); | 267 EXPECT_TRUE(client->ShouldFilterAutofillResult(form)); |
| 268 } | 268 } |
| 269 | |
| 270 TEST_F(ChromePasswordManagerClientTest, | |
| 271 IsPasswordManagerEnabledForCurrentPage) { | |
|
Mike West
2014/08/24 05:37:57
Can you add some clever bypass checks? Things that
Garrett Casto
2014/08/25 08:16:49
Added some. Interestingly a trailing dot is consid
| |
| 272 ChromePasswordManagerClient* client = GetClient(); | |
| 273 NavigateAndCommit( | |
| 274 GURL("https://accounts.google.com/ServiceLogin?continue=" | |
| 275 "https://passwords.google.com/settings&rart=123")); | |
| 276 EXPECT_FALSE(client->IsPasswordManagerEnabledForCurrentPage()); | |
| 277 | |
| 278 NavigateAndCommit( | |
| 279 GURL("https://accounts.google.com/ServiceLogin?continue=" | |
| 280 "https://passwords.google.com/settings")); | |
| 281 EXPECT_TRUE(client->IsPasswordManagerEnabledForCurrentPage()); | |
| 282 | |
| 283 // Should be enabled for other transactional reauth pages. | |
| 284 NavigateAndCommit( | |
| 285 GURL("https://accounts.google.com/ServiceLogin?continue=" | |
| 286 "https://mail.google.com&rart=234")); | |
| 287 EXPECT_TRUE(client->IsPasswordManagerEnabledForCurrentPage()); | |
| 288 | |
| 289 // Reauth pages are only on accounts.google.com | |
| 290 NavigateAndCommit( | |
| 291 GURL("https://other.site.com/ServiceLogin?continue=" | |
| 292 "https://passwords.google.com&rart=234")); | |
| 293 EXPECT_TRUE(client->IsPasswordManagerEnabledForCurrentPage()); | |
| 294 } | |
| OLD | NEW |