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

Side by Side Diff: chrome/browser/sync/engine/verify_updates_command_unittest.cc

Issue 8637006: [Sync] Make syncer commands avoid posting tasks on threads with no work to do (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head, fix windows compile Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/location.h" 5 #include "base/location.h"
6 #include "chrome/browser/sync/engine/verify_updates_command.h" 6 #include "chrome/browser/sync/engine/verify_updates_command.h"
7 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" 7 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
8 #include "chrome/browser/sync/sessions/session_state.h"
8 #include "chrome/browser/sync/sessions/sync_session.h" 9 #include "chrome/browser/sync/sessions/sync_session.h"
9 #include "chrome/browser/sync/syncable/directory_manager.h" 10 #include "chrome/browser/sync/syncable/directory_manager.h"
10 #include "chrome/browser/sync/syncable/syncable.h" 11 #include "chrome/browser/sync/syncable/syncable.h"
11 #include "chrome/browser/sync/syncable/syncable_id.h" 12 #include "chrome/browser/sync/syncable/syncable_id.h"
12 #include "chrome/browser/sync/test/engine/fake_model_worker.h" 13 #include "chrome/browser/sync/test/engine/fake_model_worker.h"
13 #include "chrome/browser/sync/test/engine/syncer_command_test.h" 14 #include "chrome/browser/sync/test/engine/syncer_command_test.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace browser_sync { 17 namespace browser_sync {
17 18
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 }; 75 };
75 76
76 TEST_F(VerifyUpdatesCommandTest, AllVerified) { 77 TEST_F(VerifyUpdatesCommandTest, AllVerified) {
77 string root = syncable::GetNullId().GetServerId(); 78 string root = syncable::GetNullId().GetServerId();
78 79
79 CreateLocalItem("b1", root, syncable::BOOKMARKS); 80 CreateLocalItem("b1", root, syncable::BOOKMARKS);
80 CreateLocalItem("b2", root, syncable::BOOKMARKS); 81 CreateLocalItem("b2", root, syncable::BOOKMARKS);
81 CreateLocalItem("p1", root, syncable::PREFERENCES); 82 CreateLocalItem("p1", root, syncable::PREFERENCES);
82 CreateLocalItem("a1", root, syncable::AUTOFILL); 83 CreateLocalItem("a1", root, syncable::AUTOFILL);
83 84
85 ExpectNoGroupsToChange(command_);
86
84 GetUpdatesResponse* updates = session()->mutable_status_controller()-> 87 GetUpdatesResponse* updates = session()->mutable_status_controller()->
85 mutable_updates_response()->mutable_get_updates(); 88 mutable_updates_response()->mutable_get_updates();
86 AddUpdate(updates, "b1", root, syncable::BOOKMARKS); 89 AddUpdate(updates, "b1", root, syncable::BOOKMARKS);
87 AddUpdate(updates, "b2", root, syncable::BOOKMARKS); 90 AddUpdate(updates, "b2", root, syncable::BOOKMARKS);
88 AddUpdate(updates, "p1", root, syncable::PREFERENCES); 91 AddUpdate(updates, "p1", root, syncable::PREFERENCES);
89 AddUpdate(updates, "a1", root, syncable::AUTOFILL); 92 AddUpdate(updates, "a1", root, syncable::AUTOFILL);
90 93
94 ExpectGroupsToChange(command_, GROUP_UI, GROUP_DB);
95
91 command_.ExecuteImpl(session()); 96 command_.ExecuteImpl(session());
92 97
93 StatusController* status = session()->mutable_status_controller(); 98 StatusController* status = session()->mutable_status_controller();
94 { 99 {
95 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_UI); 100 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_UI);
96 ASSERT_TRUE(status->update_progress()); 101 ASSERT_TRUE(status->update_progress());
97 EXPECT_EQ(3, status->update_progress()->VerifiedUpdatesSize()); 102 EXPECT_EQ(3, status->update_progress()->VerifiedUpdatesSize());
98 } 103 }
99 { 104 {
100 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_DB); 105 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_DB);
101 ASSERT_TRUE(status->update_progress()); 106 ASSERT_TRUE(status->update_progress());
102 EXPECT_EQ(1, status->update_progress()->VerifiedUpdatesSize()); 107 EXPECT_EQ(1, status->update_progress()->VerifiedUpdatesSize());
103 } 108 }
104 { 109 {
105 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE); 110 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE);
106 EXPECT_FALSE(status->update_progress()); 111 EXPECT_FALSE(status->update_progress());
107 } 112 }
108 } 113 }
109 114
110 } 115 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/verify_updates_command.cc ('k') | chrome/browser/sync/sessions/status_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698