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

Side by Side Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 72403003: sync: Per-type update application (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 // Unit tests for the SyncApi. Note that a lot of the underlying 5 // Unit tests for the SyncApi. Note that a lot of the underlying
6 // functionality is provided by the Syncable layer, which has its own 6 // functionality is provided by the Syncable layer, which has its own
7 // unit tests. We'll test SyncApi specific things in this harness. 7 // unit tests. We'll test SyncApi specific things in this harness.
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "sync/sessions/sync_session.h" 59 #include "sync/sessions/sync_session.h"
60 #include "sync/syncable/directory.h" 60 #include "sync/syncable/directory.h"
61 #include "sync/syncable/entry.h" 61 #include "sync/syncable/entry.h"
62 #include "sync/syncable/mutable_entry.h" 62 #include "sync/syncable/mutable_entry.h"
63 #include "sync/syncable/nigori_util.h" 63 #include "sync/syncable/nigori_util.h"
64 #include "sync/syncable/syncable_id.h" 64 #include "sync/syncable/syncable_id.h"
65 #include "sync/syncable/syncable_read_transaction.h" 65 #include "sync/syncable/syncable_read_transaction.h"
66 #include "sync/syncable/syncable_util.h" 66 #include "sync/syncable/syncable_util.h"
67 #include "sync/syncable/syncable_write_transaction.h" 67 #include "sync/syncable/syncable_write_transaction.h"
68 #include "sync/test/callback_counter.h" 68 #include "sync/test/callback_counter.h"
69 #include "sync/test/engine/fake_model_worker.h"
69 #include "sync/test/engine/fake_sync_scheduler.h" 70 #include "sync/test/engine/fake_sync_scheduler.h"
70 #include "sync/test/engine/test_id_factory.h" 71 #include "sync/test/engine/test_id_factory.h"
71 #include "sync/test/fake_encryptor.h" 72 #include "sync/test/fake_encryptor.h"
72 #include "sync/util/cryptographer.h" 73 #include "sync/util/cryptographer.h"
73 #include "sync/util/extensions_activity.h" 74 #include "sync/util/extensions_activity.h"
74 #include "sync/util/test_unrecoverable_error_handler.h" 75 #include "sync/util/test_unrecoverable_error_handler.h"
75 #include "sync/util/time.h" 76 #include "sync/util/time.h"
76 #include "testing/gmock/include/gmock/gmock.h" 77 #include "testing/gmock/include/gmock/gmock.h"
77 #include "testing/gtest/include/gtest/gtest.h" 78 #include "testing/gtest/include/gtest/gtest.h"
78 79
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 sync_manager_.AddObserver(&manager_observer_); 809 sync_manager_.AddObserver(&manager_observer_);
809 EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _, _)). 810 EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _, _)).
810 WillOnce(SaveArg<0>(&js_backend_)); 811 WillOnce(SaveArg<0>(&js_backend_));
811 812
812 EXPECT_FALSE(js_backend_.IsInitialized()); 813 EXPECT_FALSE(js_backend_.IsInitialized());
813 814
814 std::vector<ModelSafeWorker*> workers; 815 std::vector<ModelSafeWorker*> workers;
815 ModelSafeRoutingInfo routing_info; 816 ModelSafeRoutingInfo routing_info;
816 GetModelSafeRoutingInfo(&routing_info); 817 GetModelSafeRoutingInfo(&routing_info);
817 818
819 // This works only because all routing info types are GROUP_PASSIVE.
Nicolas Zea 2013/11/19 22:45:26 It's not clear to me what this comment is for (wha
rlarocque 2013/11/21 18:28:47 Comment updated.
820 scoped_refptr<ModelSafeWorker> worker = new FakeModelWorker(GROUP_PASSIVE);
821 workers.push_back(worker.get());
822
818 // Takes ownership of |fake_invalidator_|. 823 // Takes ownership of |fake_invalidator_|.
819 sync_manager_.Init( 824 sync_manager_.Init(
820 temp_dir_.path(), 825 temp_dir_.path(),
821 WeakHandle<JsEventHandler>(), 826 WeakHandle<JsEventHandler>(),
822 "bogus", 827 "bogus",
823 0, 828 0,
824 false, 829 false,
825 scoped_ptr<HttpPostProviderFactory>(new TestHttpPostProviderFactory()), 830 scoped_ptr<HttpPostProviderFactory>(new TestHttpPostProviderFactory()),
826 workers, 831 workers,
827 extensions_activity_.get(), 832 extensions_activity_.get(),
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after
3508 size_t folder_b_pos = 3513 size_t folder_b_pos =
3509 FindChangeInList(folder_b_id, ChangeRecord::ACTION_DELETE); 3514 FindChangeInList(folder_b_id, ChangeRecord::ACTION_DELETE);
3510 size_t child_pos = FindChangeInList(child_id, ChangeRecord::ACTION_DELETE); 3515 size_t child_pos = FindChangeInList(child_id, ChangeRecord::ACTION_DELETE);
3511 3516
3512 // Deletes should appear before updates. 3517 // Deletes should appear before updates.
3513 EXPECT_LT(child_pos, folder_a_pos); 3518 EXPECT_LT(child_pos, folder_a_pos);
3514 EXPECT_LT(folder_b_pos, folder_a_pos); 3519 EXPECT_LT(folder_b_pos, folder_a_pos);
3515 } 3520 }
3516 3521
3517 } // namespace 3522 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698