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

Unified Diff: chrome/browser/autofill/password_generator_unittest.cc

Issue 12434004: Move remaining Autofill code to //components/autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix long lines Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/password_generator.cc ('k') | chrome/browser/autofill/personal_data_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/password_generator_unittest.cc
diff --git a/chrome/browser/autofill/password_generator_unittest.cc b/chrome/browser/autofill/password_generator_unittest.cc
deleted file mode 100644
index ca04b8b36bf0b08285f718f94da187d0cc8dbab6..0000000000000000000000000000000000000000
--- a/chrome/browser/autofill/password_generator_unittest.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <locale>
-
-#include "chrome/browser/autofill/password_generator.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace autofill {
-
-TEST(PasswordGeneratorTest, PasswordLength) {
- PasswordGenerator pg1(10);
- std::string password = pg1.Generate();
- EXPECT_EQ(password.size(), 10u);
-
- PasswordGenerator pg2(-1);
- password = pg2.Generate();
- EXPECT_EQ(password.size(), PasswordGenerator::kDefaultPasswordLength);
-
- PasswordGenerator pg3(100);
- password = pg3.Generate();
- EXPECT_EQ(password.size(), PasswordGenerator::kDefaultPasswordLength);
-}
-
-TEST(PasswordGeneratorTest, PasswordPattern) {
- PasswordGenerator pg(12);
- std::string password = pg.Generate();
- int num_upper_case_letters = 0;
- int num_lower_case_letters = 0;
- int num_digits = 0;
- int num_other_symbols = 0;
- for (size_t i = 0; i < password.size(); i++) {
- if (isupper(password[i]))
- ++num_upper_case_letters;
- else if (islower(password[i]))
- ++num_lower_case_letters;
- else if (isdigit(password[i]))
- ++num_digits;
- else
- ++num_other_symbols;
- }
- EXPECT_GT(num_upper_case_letters, 0);
- EXPECT_GT(num_lower_case_letters, 0);
- EXPECT_GT(num_digits, 0);
- EXPECT_EQ(num_other_symbols, 1);
-}
-
-TEST(PasswordGeneratorTest, Printable) {
- PasswordGenerator pg(12);
- std::string password = pg.Generate();
- for (size_t i = 0; i < password.size(); i++) {
- // Make sure that the character is printable.
- EXPECT_TRUE(isgraph(password[i]));
- }
-}
-
-} // namespace autofill
« no previous file with comments | « chrome/browser/autofill/password_generator.cc ('k') | chrome/browser/autofill/personal_data_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698