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

Unified Diff: components/password_manager/content/common/credential_manager_types_unittest.cc

Issue 1031253003: Move credential_manager_types.h to components/password_manager/core. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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: components/password_manager/content/common/credential_manager_types_unittest.cc
diff --git a/components/password_manager/content/common/credential_manager_types_unittest.cc b/components/password_manager/content/common/credential_manager_types_unittest.cc
deleted file mode 100644
index e21156d43cc9c9a14d8cfd0f1c1e68508feafd3f..0000000000000000000000000000000000000000
--- a/components/password_manager/content/common/credential_manager_types_unittest.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2015 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 "components/password_manager/content/common/credential_manager_types.h"
-
-#include "base/strings/string16.h"
-#include "base/strings/utf_string_conversions.h"
-#include "components/autofill/core/common/password_form.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "url/gurl.h"
-
-namespace password_manager {
-
-class CredentialManagerTypesTest : public testing::Test {
- public:
- CredentialManagerTypesTest()
- : origin_(GURL("https://example.test/")),
- avatar_(GURL("https://fast-cdn.test/avatar.png")),
- federation_(GURL("https://federation.test/")) {}
-
- protected:
- GURL origin_;
- GURL avatar_;
- GURL federation_;
-};
-
-TEST_F(CredentialManagerTypesTest, CreatePasswordFormEmpty) {
- CredentialInfo info;
- scoped_ptr<autofill::PasswordForm> form;
-
- // Empty CredentialInfo -> nullptr.
- form = CreatePasswordFormFromCredentialInfo(info, origin_);
- EXPECT_EQ(nullptr, form.get());
-}
-
-TEST_F(CredentialManagerTypesTest, CreatePasswordFormFederation) {
- CredentialInfo info;
- scoped_ptr<autofill::PasswordForm> form;
-
- info.id = base::ASCIIToUTF16("id");
- info.name = base::ASCIIToUTF16("name");
- info.avatar = avatar_;
- info.federation = federation_;
- info.type = CredentialType::CREDENTIAL_TYPE_FEDERATED;
-
- form = CreatePasswordFormFromCredentialInfo(info, origin_);
- ASSERT_NE(nullptr, form.get());
-
- EXPECT_EQ(info.avatar, form->avatar_url);
- EXPECT_EQ(info.name, form->display_name);
- EXPECT_EQ(origin_, form->origin);
- EXPECT_EQ(autofill::PasswordForm::SCHEME_HTML, form->scheme);
-
- // Federated credentials have empty passwords, non-empty federation_urls, and
- // funky signon realms.
- EXPECT_EQ(info.federation, form->federation_url);
- EXPECT_EQ(base::string16(), form->password_value);
- EXPECT_EQ("federation://example.test/federation.test", form->signon_realm);
-}
-
-TEST_F(CredentialManagerTypesTest, CreatePasswordFormLocal) {
- CredentialInfo info;
- scoped_ptr<autofill::PasswordForm> form;
-
- info.id = base::ASCIIToUTF16("id");
- info.name = base::ASCIIToUTF16("name");
- info.avatar = avatar_;
- info.password = base::ASCIIToUTF16("password");
- info.type = CredentialType::CREDENTIAL_TYPE_LOCAL;
-
- form = CreatePasswordFormFromCredentialInfo(info, origin_);
- ASSERT_NE(nullptr, form.get());
-
- EXPECT_EQ(info.avatar, form->avatar_url);
- EXPECT_EQ(info.name, form->display_name);
- EXPECT_EQ(origin_, form->origin);
- EXPECT_EQ(autofill::PasswordForm::SCHEME_HTML, form->scheme);
-
- // Local credentials have empty federation_urls, non-empty passwords, and
- // a signon realm that matches the origin.
- EXPECT_EQ(GURL(), form->federation_url);
- EXPECT_EQ(info.password, form->password_value);
- EXPECT_EQ(origin_.spec(), form->signon_realm);
-}
-} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698