Index: chrome/browser/sync/glue/typed_url_model_associator_unittest.cc |
diff --git a/chrome/browser/sync/glue/typed_url_model_associator_unittest.cc b/chrome/browser/sync/glue/typed_url_model_associator_unittest.cc |
index e77bef071f512a9ed4bb141f83a840c351f14883..a0f9926bdcfe4e356b7d4c4071452f0b5222f7a0 100644 |
--- a/chrome/browser/sync/glue/typed_url_model_associator_unittest.cc |
+++ b/chrome/browser/sync/glue/typed_url_model_associator_unittest.cc |
@@ -20,6 +20,7 @@ |
using browser_sync::TypedUrlModelAssociator; |
using content::BrowserThread; |
+namespace { |
class SyncTypedUrlModelAssociatorTest : public testing::Test { |
public: |
static history::URLRow MakeTypedUrlRow(const char* url, |
@@ -64,6 +65,45 @@ class SyncTypedUrlModelAssociatorTest : public testing::Test { |
} |
}; |
+class TestTypedUrlModelAssociator : public TypedUrlModelAssociator { |
+ public: |
+ TestTypedUrlModelAssociator(base::WaitableEvent* startup, |
+ base::WaitableEvent* aborted) |
+ : TypedUrlModelAssociator(&mock_, NULL, NULL), |
+ startup_(startup), |
+ aborted_(aborted) {} |
+ virtual bool IsAbortPending() { |
+ // Let the main thread know that we've been started up, and block until |
+ // they've called Abort(). |
+ startup_->Signal(); |
+ EXPECT_TRUE(aborted_->TimedWait(base::TimeDelta::FromMilliseconds( |
+ TestTimeouts::action_timeout_ms()))); |
+ return TypedUrlModelAssociator::IsAbortPending(); |
+ } |
+ private: |
+ ProfileSyncServiceMock mock_; |
+ base::WaitableEvent* startup_; |
+ base::WaitableEvent* aborted_; |
+}; |
+ |
+static void CreateModelAssociator(base::WaitableEvent* startup, |
+ base::WaitableEvent* aborted, |
+ base::WaitableEvent* done, |
+ TypedUrlModelAssociator** associator) { |
+ // Grab the done lock - when we exit, this will be released and allow the |
+ // test to finish. |
+ *associator = new TestTypedUrlModelAssociator(startup, aborted); |
+ // AssociateModels should be aborted and should return false. |
+ SyncError error = (*associator)->AssociateModels(); |
+ |
+ // TODO(lipalani): crbug.com/122690 fix this when fixing abort. |
+ // EXPECT_TRUE(error.IsSet()); |
+ delete *associator; |
+ done->Signal(); |
+} |
+ |
+} // namespace |
+ |
TEST_F(SyncTypedUrlModelAssociatorTest, MergeUrls) { |
history::VisitVector visits1; |
history::URLRow row1(MakeTypedUrlRow("http://pie.com/", "pie", |
@@ -380,43 +420,6 @@ TEST_F(SyncTypedUrlModelAssociatorTest, NoTypedVisits) { |
static_cast<content::PageTransition>(typed_url.visit_transitions(0))); |
} |
-class TestTypedUrlModelAssociator : public TypedUrlModelAssociator { |
- public: |
- TestTypedUrlModelAssociator(base::WaitableEvent* startup, |
- base::WaitableEvent* aborted) |
- : TypedUrlModelAssociator(&mock_, NULL, NULL), |
- startup_(startup), |
- aborted_(aborted) {} |
- virtual bool IsAbortPending() { |
- // Let the main thread know that we've been started up, and block until |
- // they've called Abort(). |
- startup_->Signal(); |
- EXPECT_TRUE(aborted_->TimedWait(base::TimeDelta::FromMilliseconds( |
- TestTimeouts::action_timeout_ms()))); |
- return TypedUrlModelAssociator::IsAbortPending(); |
- } |
- private: |
- ProfileSyncServiceMock mock_; |
- base::WaitableEvent* startup_; |
- base::WaitableEvent* aborted_; |
-}; |
- |
-static void CreateModelAssociator(base::WaitableEvent* startup, |
- base::WaitableEvent* aborted, |
- base::WaitableEvent* done, |
- TypedUrlModelAssociator** associator) { |
- // Grab the done lock - when we exit, this will be released and allow the |
- // test to finish. |
- *associator = new TestTypedUrlModelAssociator(startup, aborted); |
- // AssociateModels should be aborted and should return false. |
- SyncError error = (*associator)->AssociateModels(); |
- |
- // TODO(lipalani): crbug.com/122690 fix this when fixing abort. |
- // EXPECT_TRUE(error.IsSet()); |
- delete *associator; |
- done->Signal(); |
-} |
- |
// This test verifies that we can abort model association from the UI thread. |
// We start up the model associator on the DB thread, block until we abort the |
// association on the UI thread, then ensure that AssociateModels() returns |