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

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

Issue 8785015: Revert 112815 - [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: 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"
9 #include "chrome/browser/sync/sessions/sync_session.h" 8 #include "chrome/browser/sync/sessions/sync_session.h"
10 #include "chrome/browser/sync/syncable/directory_manager.h" 9 #include "chrome/browser/sync/syncable/directory_manager.h"
11 #include "chrome/browser/sync/syncable/syncable.h" 10 #include "chrome/browser/sync/syncable/syncable.h"
12 #include "chrome/browser/sync/syncable/syncable_id.h" 11 #include "chrome/browser/sync/syncable/syncable_id.h"
13 #include "chrome/browser/sync/test/engine/fake_model_worker.h" 12 #include "chrome/browser/sync/test/engine/fake_model_worker.h"
14 #include "chrome/browser/sync/test/engine/syncer_command_test.h" 13 #include "chrome/browser/sync/test/engine/syncer_command_test.h"
15 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
16 15
17 namespace browser_sync { 16 namespace browser_sync {
18 17
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 }; 74 };
76 75
77 TEST_F(VerifyUpdatesCommandTest, AllVerified) { 76 TEST_F(VerifyUpdatesCommandTest, AllVerified) {
78 string root = syncable::GetNullId().GetServerId(); 77 string root = syncable::GetNullId().GetServerId();
79 78
80 CreateLocalItem("b1", root, syncable::BOOKMARKS); 79 CreateLocalItem("b1", root, syncable::BOOKMARKS);
81 CreateLocalItem("b2", root, syncable::BOOKMARKS); 80 CreateLocalItem("b2", root, syncable::BOOKMARKS);
82 CreateLocalItem("p1", root, syncable::PREFERENCES); 81 CreateLocalItem("p1", root, syncable::PREFERENCES);
83 CreateLocalItem("a1", root, syncable::AUTOFILL); 82 CreateLocalItem("a1", root, syncable::AUTOFILL);
84 83
85 ExpectNoGroupsToChange(command_);
86
87 GetUpdatesResponse* updates = session()->mutable_status_controller()-> 84 GetUpdatesResponse* updates = session()->mutable_status_controller()->
88 mutable_updates_response()->mutable_get_updates(); 85 mutable_updates_response()->mutable_get_updates();
89 AddUpdate(updates, "b1", root, syncable::BOOKMARKS); 86 AddUpdate(updates, "b1", root, syncable::BOOKMARKS);
90 AddUpdate(updates, "b2", root, syncable::BOOKMARKS); 87 AddUpdate(updates, "b2", root, syncable::BOOKMARKS);
91 AddUpdate(updates, "p1", root, syncable::PREFERENCES); 88 AddUpdate(updates, "p1", root, syncable::PREFERENCES);
92 AddUpdate(updates, "a1", root, syncable::AUTOFILL); 89 AddUpdate(updates, "a1", root, syncable::AUTOFILL);
93 90
94 ExpectGroupsToChange(command_, GROUP_UI, GROUP_DB);
95
96 command_.ExecuteImpl(session()); 91 command_.ExecuteImpl(session());
97 92
98 StatusController* status = session()->mutable_status_controller(); 93 StatusController* status = session()->mutable_status_controller();
99 { 94 {
100 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_UI); 95 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_UI);
101 ASSERT_TRUE(status->update_progress()); 96 ASSERT_TRUE(status->update_progress());
102 EXPECT_EQ(3, status->update_progress()->VerifiedUpdatesSize()); 97 EXPECT_EQ(3, status->update_progress()->VerifiedUpdatesSize());
103 } 98 }
104 { 99 {
105 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_DB); 100 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_DB);
106 ASSERT_TRUE(status->update_progress()); 101 ASSERT_TRUE(status->update_progress());
107 EXPECT_EQ(1, status->update_progress()->VerifiedUpdatesSize()); 102 EXPECT_EQ(1, status->update_progress()->VerifiedUpdatesSize());
108 } 103 }
109 { 104 {
110 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE); 105 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE);
111 EXPECT_FALSE(status->update_progress()); 106 EXPECT_FALSE(status->update_progress());
112 } 107 }
113 } 108 }
114 109
115 } 110 }
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