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

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

Issue 23140005: Added of new UMA signals in order to be able to discover early if the "save password" feature gets … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review 4 bis (Base files missing error in the previous one) Created 7 years, 3 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
OLDNEW
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/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/password_manager/mock_password_store.h" 10 #include "chrome/browser/password_manager/mock_password_store.h"
11 #include "chrome/browser/password_manager/password_manager.h" 11 #include "chrome/browser/password_manager/password_manager.h"
12 #include "chrome/browser/password_manager/password_manager_delegate.h" 12 #include "chrome/browser/password_manager/password_manager_delegate.h"
13 #include "chrome/browser/password_manager/password_manager_util.h"
13 #include "chrome/browser/password_manager/password_store.h" 14 #include "chrome/browser/password_manager/password_store.h"
14 #include "chrome/browser/password_manager/password_store_factory.h" 15 #include "chrome/browser/password_manager/password_store_factory.h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
17 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 18 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
18 #include "chrome/test/base/testing_pref_service_syncable.h" 19 #include "chrome/test/base/testing_pref_service_syncable.h"
19 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
20 #include "content/public/browser/navigation_details.h" 21 #include "content/public/browser/navigation_details.h"
21 #include "content/public/common/frame_navigate_params.h" 22 #include "content/public/common/frame_navigate_params.h"
22 #include "content/public/test/test_browser_thread.h" 23 #include "content/public/test/test_browser_thread.h"
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 manager()->OnPasswordFormsParsed(observed); // The post-navigation load. 530 manager()->OnPasswordFormsParsed(observed); // The post-navigation load.
530 manager()->OnPasswordFormsRendered(observed); // The post-navigation layout. 531 manager()->OnPasswordFormsRendered(observed); // The post-navigation layout.
531 } 532 }
532 533
533 TEST_F(PasswordManagerTest, SubmissionCallbackTest) { 534 TEST_F(PasswordManagerTest, SubmissionCallbackTest) {
534 manager()->AddSubmissionCallback(SubmissionCallback()); 535 manager()->AddSubmissionCallback(SubmissionCallback());
535 PasswordForm form = MakeSimpleForm(); 536 PasswordForm form = MakeSimpleForm();
536 OnPasswordFormSubmitted(form); 537 OnPasswordFormSubmitted(form);
537 EXPECT_TRUE(FormsAreEqual(form, submitted_form_)); 538 EXPECT_TRUE(FormsAreEqual(form, submitted_form_));
538 } 539 }
540
541 TEST_F(PasswordManagerTest, IsDomainNameMonitoredTest) {
542 std::string domain_name;
543
544 EXPECT_TRUE(password_manager_util::IsDomainNameMonitored(
545 "https://www.linkedin.com", &domain_name));
546 ASSERT_TRUE(domain_name == "linkedin.com");
Ilya Sherman 2013/08/29 06:42:21 nit: EXPECT_EQ
jdomingos 2013/08/30 21:09:20 Done.
547 EXPECT_TRUE(password_manager_util::IsDomainNameMonitored(
548 "https://www.amazon.com", &domain_name));
549 ASSERT_TRUE(domain_name == "amazon.com");
550 EXPECT_FALSE(password_manager_util::IsDomainNameMonitored(
551 "https://www.facebook.com", &domain_name));
552 ASSERT_TRUE(domain_name == "");
553 EXPECT_TRUE(password_manager_util::IsDomainNameMonitored(
554 "wikipedia.org", &domain_name));
555 ASSERT_TRUE(domain_name == "wikipedia.org");
556 EXPECT_FALSE(password_manager_util::IsDomainNameMonitored(
557 "thisisnotwikipedia.org", &domain_name));
558 ASSERT_TRUE(domain_name == "");
559 }
Ilya Sherman 2013/08/29 06:42:21 nit: This test should be placed in a file named pa
jdomingos 2013/08/30 21:09:20 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698