| 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/sync/profile_sync_service_harness.h" | 5 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <ostream> | 10 #include <ostream> |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << "."; | 757 LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << "."; |
| 758 return false; | 758 return false; |
| 759 } | 759 } |
| 760 scoped_refptr<StateChangeTimeoutEvent> timeout_signal( | 760 scoped_refptr<StateChangeTimeoutEvent> timeout_signal( |
| 761 new StateChangeTimeoutEvent(this, reason)); | 761 new StateChangeTimeoutEvent(this, reason)); |
| 762 MessageLoop* loop = MessageLoop::current(); | 762 MessageLoop* loop = MessageLoop::current(); |
| 763 bool did_allow_nestable_tasks = loop->NestableTasksAllowed(); | 763 bool did_allow_nestable_tasks = loop->NestableTasksAllowed(); |
| 764 loop->SetNestableTasksAllowed(true); | 764 loop->SetNestableTasksAllowed(true); |
| 765 loop->PostDelayedTask( | 765 loop->PostDelayedTask( |
| 766 FROM_HERE, | 766 FROM_HERE, |
| 767 NewRunnableMethod(timeout_signal.get(), | 767 base::Bind(&StateChangeTimeoutEvent::Callback, |
| 768 &StateChangeTimeoutEvent::Callback), | 768 timeout_signal.get()), |
| 769 timeout_milliseconds); | 769 timeout_milliseconds); |
| 770 loop->Run(); | 770 loop->Run(); |
| 771 loop->SetNestableTasksAllowed(did_allow_nestable_tasks); | 771 loop->SetNestableTasksAllowed(did_allow_nestable_tasks); |
| 772 if (timeout_signal->Abort()) { | 772 if (timeout_signal->Abort()) { |
| 773 VLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout succeeded"); | 773 VLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout succeeded"); |
| 774 return true; | 774 return true; |
| 775 } else { | 775 } else { |
| 776 VLOG(0) << GetClientInfoString("AwaitStatusChangeWithTimeout timed out"); | 776 VLOG(0) << GetClientInfoString("AwaitStatusChangeWithTimeout timed out"); |
| 777 return false; | 777 return false; |
| 778 } | 778 } |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 return (synced_types.count(type) != 0); | 1131 return (synced_types.count(type) != 0); |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1134 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
| 1135 DictionaryValue value; | 1135 DictionaryValue value; |
| 1136 sync_ui_util::ConstructAboutInformation(service_, &value); | 1136 sync_ui_util::ConstructAboutInformation(service_, &value); |
| 1137 std::string service_status; | 1137 std::string service_status; |
| 1138 base::JSONWriter::Write(&value, true, &service_status); | 1138 base::JSONWriter::Write(&value, true, &service_status); |
| 1139 return service_status; | 1139 return service_status; |
| 1140 } | 1140 } |
| OLD | NEW |