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

Side by Side Diff: base/crypto/rsa_private_key_unittest.cc

Issue 6714032: Move some files in base to base/memory. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: only base Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/crypto/rsa_private_key.h" 5 #include "base/crypto/rsa_private_key.h"
6 #include "base/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 // Generate random private keys with two different sizes. Reimport, then 9 // Generate random private keys with two different sizes. Reimport, then
10 // export them again. We should get back the same exact bytes. 10 // export them again. We should get back the same exact bytes.
11 TEST(RSAPrivateKeyUnitTest, InitRandomTest) { 11 TEST(RSAPrivateKeyUnitTest, InitRandomTest) {
12 scoped_ptr<base::RSAPrivateKey> keypair1(base::RSAPrivateKey::Create(1024)); 12 scoped_ptr<base::RSAPrivateKey> keypair1(base::RSAPrivateKey::Create(1024));
13 scoped_ptr<base::RSAPrivateKey> keypair2(base::RSAPrivateKey::Create(2048)); 13 scoped_ptr<base::RSAPrivateKey> keypair2(base::RSAPrivateKey::Create(2048));
14 ASSERT_TRUE(keypair1.get()); 14 ASSERT_TRUE(keypair1.get());
15 ASSERT_TRUE(keypair2.get()); 15 ASSERT_TRUE(keypair2.get());
16 16
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 ASSERT_TRUE(keypair1->ExportPrivateKey(&output1)); 374 ASSERT_TRUE(keypair1->ExportPrivateKey(&output1));
375 ASSERT_TRUE(keypair2->ExportPrivateKey(&output2)); 375 ASSERT_TRUE(keypair2->ExportPrivateKey(&output2));
376 376
377 ASSERT_EQ(input1.size(), output1.size()); 377 ASSERT_EQ(input1.size(), output1.size());
378 ASSERT_EQ(input2.size(), output2.size()); 378 ASSERT_EQ(input2.size(), output2.size());
379 ASSERT_TRUE(0 == memcmp(&output1.front(), &input1.front(), 379 ASSERT_TRUE(0 == memcmp(&output1.front(), &input1.front(),
380 input1.size())); 380 input1.size()));
381 ASSERT_TRUE(0 == memcmp(&output2.front(), &input2.front(), 381 ASSERT_TRUE(0 == memcmp(&output2.front(), &input2.front(),
382 input2.size())); 382 input2.size()));
383 } 383 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698