| OLD | NEW |
| 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/sync_session.h" | 8 #include "chrome/browser/sync/sessions/sync_session.h" |
| 9 #include "chrome/browser/sync/syncable/directory_manager.h" | 9 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 10 #include "chrome/browser/sync/syncable/syncable.h" | 10 #include "chrome/browser/sync/syncable/syncable.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 TEST_F(VerifyUpdatesCommandTest, AllVerified) { | 76 TEST_F(VerifyUpdatesCommandTest, AllVerified) { |
| 77 string root = syncable::GetNullId().GetServerId(); | 77 string root = syncable::GetNullId().GetServerId(); |
| 78 | 78 |
| 79 CreateLocalItem("b1", root, syncable::BOOKMARKS); | 79 CreateLocalItem("b1", root, syncable::BOOKMARKS); |
| 80 CreateLocalItem("b2", root, syncable::BOOKMARKS); | 80 CreateLocalItem("b2", root, syncable::BOOKMARKS); |
| 81 CreateLocalItem("p1", root, syncable::PREFERENCES); | 81 CreateLocalItem("p1", root, syncable::PREFERENCES); |
| 82 CreateLocalItem("a1", root, syncable::AUTOFILL); | 82 CreateLocalItem("a1", root, syncable::AUTOFILL); |
| 83 | 83 |
| 84 GetUpdatesResponse* updates = session()->status_controller()-> | 84 GetUpdatesResponse* updates = session()->mutable_status_controller()-> |
| 85 mutable_updates_response()->mutable_get_updates(); | 85 mutable_updates_response()->mutable_get_updates(); |
| 86 AddUpdate(updates, "b1", root, syncable::BOOKMARKS); | 86 AddUpdate(updates, "b1", root, syncable::BOOKMARKS); |
| 87 AddUpdate(updates, "b2", root, syncable::BOOKMARKS); | 87 AddUpdate(updates, "b2", root, syncable::BOOKMARKS); |
| 88 AddUpdate(updates, "p1", root, syncable::PREFERENCES); | 88 AddUpdate(updates, "p1", root, syncable::PREFERENCES); |
| 89 AddUpdate(updates, "a1", root, syncable::AUTOFILL); | 89 AddUpdate(updates, "a1", root, syncable::AUTOFILL); |
| 90 | 90 |
| 91 command_.ExecuteImpl(session()); | 91 command_.ExecuteImpl(session()); |
| 92 | 92 |
| 93 StatusController* status = session()->status_controller(); | 93 StatusController* status = session()->mutable_status_controller(); |
| 94 { | 94 { |
| 95 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_UI); | 95 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_UI); |
| 96 EXPECT_EQ(3, status->update_progress().VerifiedUpdatesSize()); | 96 ASSERT_TRUE(status->update_progress()); |
| 97 EXPECT_EQ(3, status->update_progress()->VerifiedUpdatesSize()); |
| 97 } | 98 } |
| 98 { | 99 { |
| 99 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_DB); | 100 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_DB); |
| 100 EXPECT_EQ(1, status->update_progress().VerifiedUpdatesSize()); | 101 ASSERT_TRUE(status->update_progress()); |
| 102 EXPECT_EQ(1, status->update_progress()->VerifiedUpdatesSize()); |
| 101 } | 103 } |
| 102 { | 104 { |
| 103 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE); | 105 sessions::ScopedModelSafeGroupRestriction r(status, GROUP_PASSIVE); |
| 104 EXPECT_EQ(0, status->update_progress().VerifiedUpdatesSize()); | 106 EXPECT_FALSE(status->update_progress()); |
| 105 } | 107 } |
| 106 } | 108 } |
| 107 | 109 |
| 108 } | 110 } |
| OLD | NEW |