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

Unified Diff: crypto/sha2_unittest.cc

Issue 6805019: Move crypto files out of base, to a top level directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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: crypto/sha2_unittest.cc
===================================================================
--- crypto/sha2_unittest.cc (revision 79901)
+++ crypto/sha2_unittest.cc (working copy)
@@ -1,10 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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/sha2.h"
wtc 2011/04/07 05:35:53 It is correct to include "crypto/sha2.h" first.
-
#include "base/basictypes.h"
+#include "crypto/sha2.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(Sha256Test, Test1) {
@@ -19,13 +18,14 @@
0xb4, 0x10, 0xff, 0x61,
0xf2, 0x00, 0x15, 0xad };
- uint8 output1[base::SHA256_LENGTH];
- base::SHA256HashString(input1, output1, sizeof(output1));
- for (size_t i = 0; i < base::SHA256_LENGTH; i++)
+ uint8 output1[crypto::SHA256_LENGTH];
+ crypto::SHA256HashString(input1, output1, sizeof(output1));
+ for (size_t i = 0; i < crypto::SHA256_LENGTH; i++)
EXPECT_EQ(expected1[i], static_cast<int>(output1[i]));
uint8 output_truncated1[4]; // 4 bytes == 32 bits
- base::SHA256HashString(input1, output_truncated1, sizeof(output_truncated1));
+ crypto::SHA256HashString(input1,
+ output_truncated1, sizeof(output_truncated1));
for (size_t i = 0; i < sizeof(output_truncated1); i++)
EXPECT_EQ(expected1[i], static_cast<int>(output_truncated1[i]));
}
@@ -43,9 +43,9 @@
0xb4, 0x10, 0xff, 0x61,
0xf2, 0x00, 0x15, 0xad };
- std::string output1 = base::SHA256HashString(input1);
- ASSERT_EQ(base::SHA256_LENGTH, output1.size());
- for (size_t i = 0; i < base::SHA256_LENGTH; i++)
+ std::string output1 = crypto::SHA256HashString(input1);
+ ASSERT_EQ(crypto::SHA256_LENGTH, output1.size());
+ for (size_t i = 0; i < crypto::SHA256_LENGTH; i++)
EXPECT_EQ(expected1[i], static_cast<uint8>(output1[i]));
}
@@ -62,13 +62,14 @@
0xf6, 0xec, 0xed, 0xd4,
0x19, 0xdb, 0x06, 0xc1 };
- uint8 output2[base::SHA256_LENGTH];
- base::SHA256HashString(input2, output2, sizeof(output2));
- for (size_t i = 0; i < base::SHA256_LENGTH; i++)
+ uint8 output2[crypto::SHA256_LENGTH];
+ crypto::SHA256HashString(input2, output2, sizeof(output2));
+ for (size_t i = 0; i < crypto::SHA256_LENGTH; i++)
EXPECT_EQ(expected2[i], static_cast<int>(output2[i]));
uint8 output_truncated2[6];
- base::SHA256HashString(input2, output_truncated2, sizeof(output_truncated2));
+ crypto::SHA256HashString(input2,
+ output_truncated2, sizeof(output_truncated2));
for (size_t i = 0; i < sizeof(output_truncated2); i++)
EXPECT_EQ(expected2[i], static_cast<int>(output_truncated2[i]));
}
@@ -85,13 +86,14 @@
0x04, 0x6d, 0x39, 0xcc,
0xc7, 0x11, 0x2c, 0xd0 };
- uint8 output3[base::SHA256_LENGTH];
- base::SHA256HashString(input3, output3, sizeof(output3));
- for (size_t i = 0; i < base::SHA256_LENGTH; i++)
+ uint8 output3[crypto::SHA256_LENGTH];
+ crypto::SHA256HashString(input3, output3, sizeof(output3));
+ for (size_t i = 0; i < crypto::SHA256_LENGTH; i++)
EXPECT_EQ(expected3[i], static_cast<int>(output3[i]));
uint8 output_truncated3[12];
- base::SHA256HashString(input3, output_truncated3, sizeof(output_truncated3));
+ crypto::SHA256HashString(input3,
+ output_truncated3, sizeof(output_truncated3));
for (size_t i = 0; i < sizeof(output_truncated3); i++)
EXPECT_EQ(expected3[i], static_cast<int>(output_truncated3[i]));
}

Powered by Google App Engine
This is Rietveld 408576698