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

Side by Side Diff: chrome/browser/chromeos/login/owner_manager_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: Fixes comments by eroman 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/login/owner_manager.h" 5 #include "chrome/browser/chromeos/login/owner_manager.h"
6 #include "chrome/browser/chromeos/login/owner_manager_unittest.h" 6 #include "chrome/browser/chromeos/login/owner_manager_unittest.h"
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/crypto/rsa_private_key.h"
11 #include "base/file_path.h" 10 #include "base/file_path.h"
12 #include "base/file_util.h" 11 #include "base/file_util.h"
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "base/memory/scoped_temp_dir.h" 13 #include "base/memory/scoped_temp_dir.h"
15 #include "base/nss_util.h" 14 #include "crypto/nss_util.h"
15 #include "crypto/rsa_private_key.h"
16 #include "chrome/browser/chromeos/login/mock_owner_key_utils.h" 16 #include "chrome/browser/chromeos/login/mock_owner_key_utils.h"
17 #include "content/browser/browser_thread.h" 17 #include "content/browser/browser_thread.h"
18 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 using ::base::RSAPrivateKey; 21 using ::crypto::RSAPrivateKey;
22 using ::testing::DoAll; 22 using ::testing::DoAll;
23 using ::testing::Eq; 23 using ::testing::Eq;
24 using ::testing::Invoke; 24 using ::testing::Invoke;
25 using ::testing::Return; 25 using ::testing::Return;
26 using ::testing::SetArgumentPointee; 26 using ::testing::SetArgumentPointee;
27 using ::testing::_; 27 using ::testing::_;
28 28
29 namespace chromeos { 29 namespace chromeos {
30 30
31 class OwnerManagerTest : public ::testing::Test { 31 class OwnerManagerTest : public ::testing::Test {
32 public: 32 public:
33 OwnerManagerTest() 33 OwnerManagerTest()
34 : message_loop_(MessageLoop::TYPE_UI), 34 : message_loop_(MessageLoop::TYPE_UI),
35 ui_thread_(BrowserThread::UI, &message_loop_), 35 ui_thread_(BrowserThread::UI, &message_loop_),
36 file_thread_(BrowserThread::FILE), 36 file_thread_(BrowserThread::FILE),
37 mock_(new MockKeyUtils), 37 mock_(new MockKeyUtils),
38 injector_(mock_) /* injector_ takes ownership of mock_ */ { 38 injector_(mock_) /* injector_ takes ownership of mock_ */ {
39 } 39 }
40 virtual ~OwnerManagerTest() {} 40 virtual ~OwnerManagerTest() {}
41 41
42 virtual void SetUp() { 42 virtual void SetUp() {
43 base::OpenPersistentNSSDB(); // TODO(cmasone): use test DB instead 43 crypto::OpenPersistentNSSDB(); // TODO(cmasone): use test DB instead
44 fake_private_key_.reset(RSAPrivateKey::Create(256)); 44 fake_private_key_.reset(RSAPrivateKey::Create(256));
45 ASSERT_TRUE(fake_private_key_->ExportPublicKey(&fake_public_key_)); 45 ASSERT_TRUE(fake_private_key_->ExportPublicKey(&fake_public_key_));
46 46
47 // Mimic ownership. 47 // Mimic ownership.
48 ASSERT_TRUE(tmpdir_.CreateUniqueTempDir()); 48 ASSERT_TRUE(tmpdir_.CreateUniqueTempDir());
49 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(tmpdir_.path(), &tmpfile_)); 49 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(tmpdir_.path(), &tmpfile_));
50 50
51 file_thread_.Start(); 51 file_thread_.Start();
52 OwnerKeyUtils::set_factory(&injector_); 52 OwnerKeyUtils::set_factory(&injector_);
53 } 53 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 BrowserThread::FILE, FROM_HERE, 239 BrowserThread::FILE, FROM_HERE,
240 NewRunnableMethod(manager.get(), 240 NewRunnableMethod(manager.get(),
241 &OwnerManager::Sign, 241 &OwnerManager::Sign,
242 BrowserThread::UI, 242 BrowserThread::UI,
243 data, 243 data,
244 &delegate)); 244 &delegate));
245 message_loop_.Run(); 245 message_loop_.Run();
246 } 246 }
247 247
248 } // namespace chromeos 248 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/owner_manager.h ('k') | chrome/browser/chromeos/login/ownership_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698