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/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 namespace chromeos { | 29 namespace chromeos { |
30 | 30 |
31 //////////////////////////////////////////////////////////////////////////////// | 31 //////////////////////////////////////////////////////////////////////////////// |
32 // MockKeyLoadObserver | 32 // MockKeyLoadObserver |
33 MockKeyLoadObserver::MockKeyLoadObserver(base::WaitableEvent* e) | 33 MockKeyLoadObserver::MockKeyLoadObserver(base::WaitableEvent* e) |
34 : success_expected_(false), | 34 : success_expected_(false), |
35 event_(e), | 35 event_(e), |
36 observed_(false) { | 36 observed_(false) { |
37 registrar_.Add( | 37 registrar_.Add( |
38 this, | 38 this, |
39 NotificationType::OWNER_KEY_FETCH_ATTEMPT_FAILED, | 39 chrome::OWNER_KEY_FETCH_ATTEMPT_FAILED, |
40 NotificationService::AllSources()); | 40 NotificationService::AllSources()); |
41 registrar_.Add( | 41 registrar_.Add( |
42 this, | 42 this, |
43 NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, | 43 chrome::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, |
44 NotificationService::AllSources()); | 44 NotificationService::AllSources()); |
45 } | 45 } |
46 | 46 |
47 MockKeyLoadObserver::~MockKeyLoadObserver() { | 47 MockKeyLoadObserver::~MockKeyLoadObserver() { |
48 DCHECK(observed_); | 48 DCHECK(observed_); |
49 } | 49 } |
50 | 50 |
51 void MockKeyLoadObserver::Observe(NotificationType type, | 51 void MockKeyLoadObserver::Observe(int type, |
52 const NotificationSource& source, | 52 const NotificationSource& source, |
53 const NotificationDetails& details) { | 53 const NotificationDetails& details) { |
54 LOG(INFO) << "Observed key fetch event"; | 54 LOG(INFO) << "Observed key fetch event"; |
55 if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { | 55 if (type == chrome::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { |
56 DCHECK(success_expected_); | 56 DCHECK(success_expected_); |
57 observed_ = true; | 57 observed_ = true; |
58 if (event_) | 58 if (event_) |
59 event_->Signal(); | 59 event_->Signal(); |
60 } else if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_FAILED) { | 60 } else if (type == chrome::OWNER_KEY_FETCH_ATTEMPT_FAILED) { |
61 DCHECK(!success_expected_); | 61 DCHECK(!success_expected_); |
62 observed_ = true; | 62 observed_ = true; |
63 if (event_) | 63 if (event_) |
64 event_->Signal(); | 64 event_->Signal(); |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 void MockKeyLoadObserver::ExpectKeyFetchSuccess(bool should_succeed) { | 68 void MockKeyLoadObserver::ExpectKeyFetchSuccess(bool should_succeed) { |
69 success_expected_ = should_succeed; | 69 success_expected_ = should_succeed; |
70 } | 70 } |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 NewRunnableMethod(manager.get(), | 354 NewRunnableMethod(manager.get(), |
355 &OwnerManager::Sign, | 355 &OwnerManager::Sign, |
356 BrowserThread::UI, | 356 BrowserThread::UI, |
357 data, | 357 data, |
358 &delegate)); | 358 &delegate)); |
359 while (!event.IsSignaled()) | 359 while (!event.IsSignaled()) |
360 message_loop_.RunAllPending(); | 360 message_loop_.RunAllPending(); |
361 } | 361 } |
362 | 362 |
363 } // namespace chromeos | 363 } // namespace chromeos |
OLD | NEW |