Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client_unittest.cc

Issue 184103016: Autofill: Refactoring to support fetching password after a username is selected (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error on Chrome OS. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/test/base/chrome_render_view_host_test_harness.h" 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
8 #include "components/password_manager/core/browser/password_manager_logger.h" 8 #include "components/password_manager/core/browser/password_manager_logger.h"
9 #include "content/public/browser/browser_context.h" 9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 17 matching lines...) Expand all
28 class ChromePasswordManagerClientTest : public ChromeRenderViewHostTestHarness { 28 class ChromePasswordManagerClientTest : public ChromeRenderViewHostTestHarness {
29 public: 29 public:
30 virtual void SetUp() OVERRIDE; 30 virtual void SetUp() OVERRIDE;
31 31
32 protected: 32 protected:
33 ChromePasswordManagerClient* GetClient(); 33 ChromePasswordManagerClient* GetClient();
34 }; 34 };
35 35
36 void ChromePasswordManagerClientTest::SetUp() { 36 void ChromePasswordManagerClientTest::SetUp() {
37 ChromeRenderViewHostTestHarness::SetUp(); 37 ChromeRenderViewHostTestHarness::SetUp();
38 ChromePasswordManagerClient::CreateForWebContents(web_contents()); 38 ChromePasswordManagerClient::CreateForWebContentsWithAutofillManagerDelegate(
39 web_contents(), NULL);
39 } 40 }
40 41
41 ChromePasswordManagerClient* ChromePasswordManagerClientTest::GetClient() { 42 ChromePasswordManagerClient* ChromePasswordManagerClientTest::GetClient() {
42 return ChromePasswordManagerClient::FromWebContents(web_contents()); 43 return ChromePasswordManagerClient::FromWebContents(web_contents());
43 } 44 }
44 45
45 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgress) { 46 TEST_F(ChromePasswordManagerClientTest, LogSavePasswordProgress) {
46 ChromePasswordManagerClient* client = GetClient(); 47 ChromePasswordManagerClient* client = GetClient();
47 testing::StrictMock<MockPasswordManagerLogger> logger; 48 testing::StrictMock<MockPasswordManagerLogger> logger;
48 const std::string text("abcd1234"); 49 const std::string text("abcd1234");
49 50
50 // Before attaching the logger, no text should be passed. 51 // Before attaching the logger, no text should be passed.
51 client->LogSavePasswordProgress(text); 52 client->LogSavePasswordProgress(text);
52 53
53 // After attaching the logger, text should be passed. 54 // After attaching the logger, text should be passed.
54 client->SetLogger(&logger); 55 client->SetLogger(&logger);
55 EXPECT_CALL(logger, LogSavePasswordProgress(text)).Times(1); 56 EXPECT_CALL(logger, LogSavePasswordProgress(text)).Times(1);
56 client->LogSavePasswordProgress(text); 57 client->LogSavePasswordProgress(text);
57 58
58 // After detaching the logger, no text should be passed again. 59 // After detaching the logger, no text should be passed again.
59 client->SetLogger(NULL); 60 client->SetLogger(NULL);
60 client->LogSavePasswordProgress(text); 61 client->LogSavePasswordProgress(text);
61 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698