OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/password_manager/password_form_manager.h" | 9 #include "chrome/browser/password_manager/password_form_manager.h" |
10 #include "chrome/browser/password_manager/password_manager.h" | 10 #include "chrome/browser/password_manager/password_manager.h" |
11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/test/base/testing_browser_process_test.h" | |
13 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
14 #include "webkit/glue/password_form.h" | 13 #include "webkit/glue/password_form.h" |
15 | 14 |
16 using webkit_glue::PasswordForm; | 15 using webkit_glue::PasswordForm; |
17 | 16 |
18 class PasswordFormManagerTest : public TestingBrowserProcessTest { | 17 class PasswordFormManagerTest : public testing::Test { |
19 public: | 18 public: |
20 PasswordFormManagerTest() { | 19 PasswordFormManagerTest() { |
21 } | 20 } |
22 virtual void SetUp() { | 21 virtual void SetUp() { |
23 observed_form_.origin = GURL("http://www.google.com/a/LoginAuth"); | 22 observed_form_.origin = GURL("http://www.google.com/a/LoginAuth"); |
24 observed_form_.action = GURL("http://www.google.com/a/Login"); | 23 observed_form_.action = GURL("http://www.google.com/a/Login"); |
25 observed_form_.username_element = ASCIIToUTF16("Email"); | 24 observed_form_.username_element = ASCIIToUTF16("Email"); |
26 observed_form_.password_element = ASCIIToUTF16("Passwd"); | 25 observed_form_.password_element = ASCIIToUTF16("Passwd"); |
27 observed_form_.submit_element = ASCIIToUTF16("signIn"); | 26 observed_form_.submit_element = ASCIIToUTF16("signIn"); |
28 observed_form_.signon_realm = "http://www.google.com"; | 27 observed_form_.signon_realm = "http://www.google.com"; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 SimulateMatchingPhase(&manager3, false); | 255 SimulateMatchingPhase(&manager3, false); |
257 EXPECT_TRUE(manager3.HasValidPasswordForm()); | 256 EXPECT_TRUE(manager3.HasValidPasswordForm()); |
258 | 257 |
259 // Form with neither a password_element nor a username_element. | 258 // Form with neither a password_element nor a username_element. |
260 credentials.username_element.clear(); | 259 credentials.username_element.clear(); |
261 credentials.password_element.clear(); | 260 credentials.password_element.clear(); |
262 PasswordFormManager manager4(profile(), NULL, credentials, false); | 261 PasswordFormManager manager4(profile(), NULL, credentials, false); |
263 SimulateMatchingPhase(&manager4, false); | 262 SimulateMatchingPhase(&manager4, false); |
264 EXPECT_TRUE(manager4.HasValidPasswordForm()); | 263 EXPECT_TRUE(manager4.HasValidPasswordForm()); |
265 } | 264 } |
OLD | NEW |