OLD | NEW |
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/bind.h" | 10 #include "base/bind.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/scoped_temp_dir.h" | 14 #include "base/scoped_temp_dir.h" |
15 #include "chrome/browser/chromeos/login/mock_owner_key_utils.h" | 15 #include "chrome/browser/chromeos/login/mock_owner_key_utils.h" |
16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
17 #include "content/browser/browser_thread.h" | 17 #include "content/browser/browser_thread.h" |
| 18 #include "content/public/browser/notification_service.h" |
18 #include "crypto/nss_util.h" | 19 #include "crypto/nss_util.h" |
19 #include "crypto/rsa_private_key.h" | 20 #include "crypto/rsa_private_key.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
22 | 23 |
23 using ::crypto::RSAPrivateKey; | 24 using ::crypto::RSAPrivateKey; |
24 using ::testing::DoAll; | 25 using ::testing::DoAll; |
25 using ::testing::Eq; | 26 using ::testing::Eq; |
26 using ::testing::Invoke; | 27 using ::testing::Invoke; |
27 using ::testing::Return; | 28 using ::testing::Return; |
28 using ::testing::SetArgumentPointee; | 29 using ::testing::SetArgumentPointee; |
29 using ::testing::_; | 30 using ::testing::_; |
30 | 31 |
31 namespace chromeos { | 32 namespace chromeos { |
32 | 33 |
33 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
34 // MockKeyLoadObserver | 35 // MockKeyLoadObserver |
35 MockKeyLoadObserver::MockKeyLoadObserver(base::WaitableEvent* e) | 36 MockKeyLoadObserver::MockKeyLoadObserver(base::WaitableEvent* e) |
36 : success_expected_(false), | 37 : success_expected_(false), |
37 event_(e), | 38 event_(e), |
38 observed_(false) { | 39 observed_(false) { |
39 registrar_.Add( | 40 registrar_.Add( |
40 this, | 41 this, |
41 chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED, | 42 chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED, |
42 NotificationService::AllSources()); | 43 content::NotificationService::AllSources()); |
43 registrar_.Add( | 44 registrar_.Add( |
44 this, | 45 this, |
45 chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, | 46 chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, |
46 NotificationService::AllSources()); | 47 content::NotificationService::AllSources()); |
47 } | 48 } |
48 | 49 |
49 MockKeyLoadObserver::~MockKeyLoadObserver() { | 50 MockKeyLoadObserver::~MockKeyLoadObserver() { |
50 DCHECK(observed_); | 51 DCHECK(observed_); |
51 } | 52 } |
52 | 53 |
53 void MockKeyLoadObserver::Observe(int type, | 54 void MockKeyLoadObserver::Observe(int type, |
54 const content::NotificationSource& source, | 55 const content::NotificationSource& source, |
55 const content::NotificationDetails& details) { | 56 const content::NotificationDetails& details) { |
56 LOG(INFO) << "Observed key fetch event"; | 57 LOG(INFO) << "Observed key fetch event"; |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 336 |
336 BrowserThread::PostTask( | 337 BrowserThread::PostTask( |
337 BrowserThread::FILE, FROM_HERE, | 338 BrowserThread::FILE, FROM_HERE, |
338 base::Bind(&OwnerManager::Sign, manager.get(), BrowserThread::UI, data, | 339 base::Bind(&OwnerManager::Sign, manager.get(), BrowserThread::UI, data, |
339 &delegate)); | 340 &delegate)); |
340 while (!event.IsSignaled()) | 341 while (!event.IsSignaled()) |
341 message_loop_.RunAllPending(); | 342 message_loop_.RunAllPending(); |
342 } | 343 } |
343 | 344 |
344 } // namespace chromeos | 345 } // namespace chromeos |
OLD | NEW |