| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/password_manager/mock_password_store.h" | 10 #include "chrome/browser/password_manager/mock_password_store.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 arg0->OnGetPasswordStoreResults(forms); | 43 arg0->OnGetPasswordStoreResults(forms); |
| 44 } | 44 } |
| 45 | 45 |
| 46 ACTION_P(SaveToScopedPtr, scoped) { | 46 ACTION_P(SaveToScopedPtr, scoped) { |
| 47 scoped->reset(arg0); | 47 scoped->reset(arg0); |
| 48 } | 48 } |
| 49 | 49 |
| 50 class PasswordManagerTest : public ChromeRenderViewHostTestHarness { | 50 class PasswordManagerTest : public ChromeRenderViewHostTestHarness { |
| 51 public: | 51 public: |
| 52 PasswordManagerTest() | 52 PasswordManagerTest() |
| 53 : ui_thread_(BrowserThread::UI, MessageLoopForUI::current()) {} | 53 : ui_thread_(BrowserThread::UI, base::MessageLoopForUI::current()) {} |
| 54 virtual ~PasswordManagerTest() {} | 54 virtual ~PasswordManagerTest() {} |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 virtual void SetUp() { | 57 virtual void SetUp() { |
| 58 testing_profile_ = new TestingProfile; | 58 testing_profile_ = new TestingProfile; |
| 59 store_ = static_cast<MockPasswordStore*>( | 59 store_ = static_cast<MockPasswordStore*>( |
| 60 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( | 60 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( |
| 61 testing_profile_, MockPasswordStore::Build).get()); | 61 testing_profile_, MockPasswordStore::Build).get()); |
| 62 browser_context_.reset(testing_profile_); | 62 browser_context_.reset(testing_profile_); |
| 63 ChromeRenderViewHostTestHarness::SetUp(); | 63 ChromeRenderViewHostTestHarness::SetUp(); |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // navigation occurs. | 483 // navigation occurs. |
| 484 EXPECT_CALL(delegate_, | 484 EXPECT_CALL(delegate_, |
| 485 AddSavePasswordInfoBarIfPermitted(_)).Times(Exactly(0)); | 485 AddSavePasswordInfoBarIfPermitted(_)).Times(Exactly(0)); |
| 486 EXPECT_CALL(*store_, AddLogin(FormMatches(form))); | 486 EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| 487 | 487 |
| 488 // Now the password manager waits for the navigation to complete. | 488 // Now the password manager waits for the navigation to complete. |
| 489 observed.clear(); | 489 observed.clear(); |
| 490 manager()->OnPasswordFormsParsed(observed); // The post-navigation load. | 490 manager()->OnPasswordFormsParsed(observed); // The post-navigation load. |
| 491 manager()->OnPasswordFormsRendered(observed); // The post-navigation layout. | 491 manager()->OnPasswordFormsRendered(observed); // The post-navigation layout. |
| 492 } | 492 } |
| OLD | NEW |