OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/profile_sync_service_harness.h" | 5 #include "chrome/browser/sync/profile_sync_service_harness.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <set> | 10 #include <set> |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout( | 739 bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout( |
740 int timeout_milliseconds, | 740 int timeout_milliseconds, |
741 const std::string& reason) { | 741 const std::string& reason) { |
742 DVLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout"); | 742 DVLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout"); |
743 if (wait_state_ == SYNC_DISABLED) { | 743 if (wait_state_ == SYNC_DISABLED) { |
744 LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << "."; | 744 LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << "."; |
745 return false; | 745 return false; |
746 } | 746 } |
747 scoped_refptr<StateChangeTimeoutEvent> timeout_signal( | 747 scoped_refptr<StateChangeTimeoutEvent> timeout_signal( |
748 new StateChangeTimeoutEvent(this, reason)); | 748 new StateChangeTimeoutEvent(this, reason)); |
749 | |
jar (doing other things)
2012/02/11 03:24:38
nit: You probably don't need the black line.
dhollowa
2012/02/13 17:44:26
Done.
| |
749 MessageLoop* loop = MessageLoop::current(); | 750 MessageLoop* loop = MessageLoop::current(); |
750 bool did_allow_nestable_tasks = loop->NestableTasksAllowed(); | 751 MessageLoop::ScopedNestableTaskAllower allow(loop); |
751 loop->SetNestableTasksAllowed(true); | |
752 loop->PostDelayedTask( | 752 loop->PostDelayedTask( |
753 FROM_HERE, | 753 FROM_HERE, |
754 base::Bind(&StateChangeTimeoutEvent::Callback, | 754 base::Bind(&StateChangeTimeoutEvent::Callback, |
755 timeout_signal.get()), | 755 timeout_signal.get()), |
756 base::TimeDelta::FromMilliseconds(timeout_milliseconds)); | 756 base::TimeDelta::FromMilliseconds(timeout_milliseconds)); |
757 loop->Run(); | 757 loop->Run(); |
758 loop->SetNestableTasksAllowed(did_allow_nestable_tasks); | 758 |
759 if (timeout_signal->Abort()) { | 759 if (timeout_signal->Abort()) { |
Ryan Sleevi
2012/02/11 02:17:22
Is it any concern that this call now runs while ne
jar (doing other things)
2012/02/11 03:24:38
+1
Please enclose lines 751 to 757 in a local sco
dhollowa
2012/02/13 17:44:26
I'd left it out for readability, the signal manipu
dhollowa
2012/02/13 17:44:26
Done.
| |
760 DVLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout succeeded"); | 760 DVLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout succeeded"); |
761 return true; | 761 return true; |
762 } else { | 762 } else { |
763 DVLOG(0) << GetClientInfoString("AwaitStatusChangeWithTimeout timed out"); | 763 DVLOG(0) << GetClientInfoString("AwaitStatusChangeWithTimeout timed out"); |
764 return false; | 764 return false; |
765 } | 765 } |
766 } | 766 } |
767 | 767 |
768 ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() { | 768 ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() { |
769 DCHECK(service() != NULL) << "GetStatus(): service() is NULL."; | 769 DCHECK(service() != NULL) << "GetStatus(): service() is NULL."; |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1116 return state_map.size(); | 1116 return state_map.size(); |
1117 } | 1117 } |
1118 | 1118 |
1119 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1119 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
1120 DictionaryValue value; | 1120 DictionaryValue value; |
1121 sync_ui_util::ConstructAboutInformation(service_, &value); | 1121 sync_ui_util::ConstructAboutInformation(service_, &value); |
1122 std::string service_status; | 1122 std::string service_status; |
1123 base::JSONWriter::Write(&value, true, &service_status); | 1123 base::JSONWriter::Write(&value, true, &service_status); |
1124 return service_status; | 1124 return service_status; |
1125 } | 1125 } |
OLD | NEW |