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

Unified Diff: chrome/browser/managed_mode/managed_user_passphrase_unittest.cc

Issue 15715005: Remove passphrase dialog and last parts of elevation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 7 years, 7 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/managed_mode/managed_user_passphrase_unittest.cc
diff --git a/chrome/browser/managed_mode/managed_user_passphrase_unittest.cc b/chrome/browser/managed_mode/managed_user_passphrase_unittest.cc
deleted file mode 100644
index c9f0fbb00cdc415f5242a44e2a19c0e9ed5111a2..0000000000000000000000000000000000000000
--- a/chrome/browser/managed_mode/managed_user_passphrase_unittest.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2013 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 "chrome/browser/managed_mode/managed_user_passphrase.h"
-
-#include <string>
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-// This test checks the class ManagedUserPassphrase when providing a salt
-// as parameter of the constructor.
-TEST(ManagedUserPassphraseTest, WithSaltProvided) {
- std::string salt = "my special salt";
- std::string salt2 = "my other special salt";
- ManagedUserPassphrase instance_with_provided_salt(salt);
- ManagedUserPassphrase other_instance_with_provided_salt(salt2);
-
- // We expect that the provided salt is used internally as well.
- EXPECT_STREQ(salt.c_str(), instance_with_provided_salt.GetSalt().c_str());
- std::string passphrase_hash;
- std::string passphrase = "some_passphrase123";
- EXPECT_TRUE(instance_with_provided_salt.GenerateHashFromPassphrase(
- passphrase,
- &passphrase_hash));
- // As the method generates a Base64 encoded 128 bit key, we expect the
- // passphrase hash to have length at least 7 bytes.
- EXPECT_GE(passphrase_hash.size(), 7u);
-
- // When calling the function with a (slightly) different parameter, we
- // expect to get a different result.
- std::string passphrase2 = passphrase + "4";
- std::string passphrase_hash2;
- EXPECT_TRUE(instance_with_provided_salt.GenerateHashFromPassphrase(
- passphrase2,
- &passphrase_hash2));
- EXPECT_GE(passphrase_hash2.size(), 7u);
- EXPECT_STRNE(passphrase_hash.c_str(), passphrase_hash2.c_str());
-
- // When calling the function again with the first parameter, we expect to
- // get the same result as in the first call.
- EXPECT_TRUE(instance_with_provided_salt.GenerateHashFromPassphrase(
- passphrase,
- &passphrase_hash2));
- EXPECT_STREQ(passphrase_hash.c_str(), passphrase_hash2.c_str());
-
- // When calling the function on the instance with the other salt, but
- // with the same passphrase, we expect to get a different result.
- EXPECT_TRUE(other_instance_with_provided_salt.GenerateHashFromPassphrase(
- passphrase,
- &passphrase_hash2));
- EXPECT_STRNE(passphrase_hash.c_str(), passphrase_hash2.c_str());
-}
-
-// This test checks the class ManagedUserPassphraseTest when no salt is
-// provided as parameter of the constructor.
-TEST(ManagedUserPassphraseTest, WithEmptySalt) {
- ManagedUserPassphrase instance_with_empty_salt((std::string()));
- ManagedUserPassphrase other_instance_with_empty_salt((std::string()));
- std::string salt = instance_with_empty_salt.GetSalt();
- std::string salt2 = other_instance_with_empty_salt.GetSalt();
-
- // We expect that the class will generate a salt randomly, and for different
- // instances a different salt is calculated.
- EXPECT_GT(salt.size(), 0u);
- EXPECT_GT(salt2.size(), 0u);
- EXPECT_STRNE(salt.c_str(), salt2.c_str());
-}
« no previous file with comments | « chrome/browser/managed_mode/managed_user_passphrase.cc ('k') | chrome/browser/managed_mode/managed_user_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698