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

Unified Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc

Issue 221853003: Password bubble: Add a test for displayed password length. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
Index: chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4b791f120ccb3973ff7f803c0e5b8ca25c000b17
--- /dev/null
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
@@ -0,0 +1,40 @@
+// Copyright 2014 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 "base/strings/utf_string_conversions.h"
+#include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
+#include "components/password_manager/core/browser/mock_password_store.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class ManagePasswordsBubbleModelTest : public testing::Test {
+ protected:
+ ManagePasswordsBubbleModelTest() {}
+
+ virtual ~ManagePasswordsBubbleModelTest() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModelTest);
+};
+
+namespace {
+
+TEST_F(ManagePasswordsBubbleModelTest, PasswordDisplayStringGeneration) {
+ base::string16 test1 = base::WideToUTF16(L"Password");
+ base::string16 test2 = base::WideToUTF16(L"Ümläütß");
+
+ base::string16 result =
+ ManagePasswordsBubbleModel::GetPasswordDisplayString(test1);
+ EXPECT_EQ(8UL, result.length());
+ EXPECT_EQ(
+ base::WideToUTF16(L"\x2022\x2022\x2022\x2022\x2022\x2022\x2022\x2022"),
+ result);
+
+ result = ManagePasswordsBubbleModel::GetPasswordDisplayString(test2);
+ EXPECT_EQ(7UL, result.length());
+ EXPECT_EQ(base::WideToUTF16(L"\x2022\x2022\x2022\x2022\x2022\x2022\x2022"),
+ result);
+}
+
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698