| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/string_piece.h" | 7 #include "base/string_piece.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 static void CreateModelAssociator(base::WaitableEvent* startup, | 89 static void CreateModelAssociator(base::WaitableEvent* startup, |
| 90 base::WaitableEvent* aborted, | 90 base::WaitableEvent* aborted, |
| 91 base::WaitableEvent* done, | 91 base::WaitableEvent* done, |
| 92 TypedUrlModelAssociator** associator) { | 92 TypedUrlModelAssociator** associator) { |
| 93 // Grab the done lock - when we exit, this will be released and allow the | 93 // Grab the done lock - when we exit, this will be released and allow the |
| 94 // test to finish. | 94 // test to finish. |
| 95 *associator = new TestTypedUrlModelAssociator(startup, aborted); | 95 *associator = new TestTypedUrlModelAssociator(startup, aborted); |
| 96 // AssociateModels should be aborted and should return false. | 96 // AssociateModels should be aborted and should return false. |
| 97 SyncError error = (*associator)->AssociateModels(); | 97 csync::SyncError error = (*associator)->AssociateModels(); |
| 98 | 98 |
| 99 // TODO(lipalani): crbug.com/122690 fix this when fixing abort. | 99 // TODO(lipalani): crbug.com/122690 fix this when fixing abort. |
| 100 // EXPECT_TRUE(error.IsSet()); | 100 // EXPECT_TRUE(error.IsSet()); |
| 101 delete *associator; | 101 delete *associator; |
| 102 done->Signal(); | 102 done->Signal(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace | 105 } // namespace |
| 106 | 106 |
| 107 TEST_F(SyncTypedUrlModelAssociatorTest, MergeUrls) { | 107 TEST_F(SyncTypedUrlModelAssociatorTest, MergeUrls) { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 ASSERT_TRUE(startup.TimedWait(base::TimeDelta::FromMilliseconds( | 440 ASSERT_TRUE(startup.TimedWait(base::TimeDelta::FromMilliseconds( |
| 441 TestTimeouts::action_timeout_ms()))); | 441 TestTimeouts::action_timeout_ms()))); |
| 442 // Abort the model assocation - this should be callable from any thread. | 442 // Abort the model assocation - this should be callable from any thread. |
| 443 associator->AbortAssociation(); | 443 associator->AbortAssociation(); |
| 444 // Tell the remote thread to continue. | 444 // Tell the remote thread to continue. |
| 445 aborted.Signal(); | 445 aborted.Signal(); |
| 446 // Block until CreateModelAssociator() exits. | 446 // Block until CreateModelAssociator() exits. |
| 447 ASSERT_TRUE(done.TimedWait(base::TimeDelta::FromMilliseconds( | 447 ASSERT_TRUE(done.TimedWait(base::TimeDelta::FromMilliseconds( |
| 448 TestTimeouts::action_timeout_ms()))); | 448 TestTimeouts::action_timeout_ms()))); |
| 449 } | 449 } |
| OLD | NEW |