Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: chrome/browser/sync/glue/typed_url_model_associator_unittest.cc

Issue 10257026: Log UMA stats on Typed URL DB errors instead of stopping sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compilation err. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « chrome/browser/sync/glue/typed_url_model_associator.cc ('k') | chrome/browser/sync/profile_sync_service_typed_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698