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

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

Issue 1285443002: move V2 classes in chrome/engine to syncer_v2 namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/sequenced_task_runner.h" 7 #include "base/sequenced_task_runner.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "sync/engine/model_type_sync_proxy_impl.h" 9 #include "sync/engine/model_type_sync_proxy_impl.h"
10 #include "sync/internal_api/public/base/model_type.h" 10 #include "sync/internal_api/public/base/model_type.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 std::vector<scoped_refptr<syncer::ModelSafeWorker>> workers_; 51 std::vector<scoped_refptr<syncer::ModelSafeWorker>> workers_;
52 syncer::TestDirectorySetterUpper dir_maker_; 52 syncer::TestDirectorySetterUpper dir_maker_;
53 syncer::MockNudgeHandler nudge_handler_; 53 syncer::MockNudgeHandler nudge_handler_;
54 scoped_ptr<syncer::ModelTypeRegistry> registry_; 54 scoped_ptr<syncer::ModelTypeRegistry> registry_;
55 55
56 scoped_ptr<SyncContextProxyImpl> context_proxy_; 56 scoped_ptr<SyncContextProxyImpl> context_proxy_;
57 }; 57 };
58 58
59 // Try to connect a type to a SyncContext that has already shut down. 59 // Try to connect a type to a SyncContext that has already shut down.
60 TEST_F(SyncContextProxyImplTest, FailToConnect1) { 60 TEST_F(SyncContextProxyImplTest, FailToConnect1) {
61 syncer::ModelTypeSyncProxyImpl themes_sync_proxy(syncer::THEMES); 61 ModelTypeSyncProxyImpl themes_sync_proxy(syncer::THEMES);
62 DisableSync(); 62 DisableSync();
63 themes_sync_proxy.Enable(GetProxy()); 63 themes_sync_proxy.Enable(GetProxy());
64 64
65 base::RunLoop run_loop_; 65 base::RunLoop run_loop_;
66 run_loop_.RunUntilIdle(); 66 run_loop_.RunUntilIdle();
67 EXPECT_FALSE(themes_sync_proxy.IsConnected()); 67 EXPECT_FALSE(themes_sync_proxy.IsConnected());
68 } 68 }
69 69
70 // Try to connect a type to a SyncContext as it shuts down. 70 // Try to connect a type to a SyncContext as it shuts down.
71 TEST_F(SyncContextProxyImplTest, FailToConnect2) { 71 TEST_F(SyncContextProxyImplTest, FailToConnect2) {
72 syncer::ModelTypeSyncProxyImpl themes_sync_proxy(syncer::THEMES); 72 ModelTypeSyncProxyImpl themes_sync_proxy(syncer::THEMES);
73 themes_sync_proxy.Enable(GetProxy()); 73 themes_sync_proxy.Enable(GetProxy());
74 DisableSync(); 74 DisableSync();
75 75
76 base::RunLoop run_loop_; 76 base::RunLoop run_loop_;
77 run_loop_.RunUntilIdle(); 77 run_loop_.RunUntilIdle();
78 EXPECT_FALSE(themes_sync_proxy.IsConnected()); 78 EXPECT_FALSE(themes_sync_proxy.IsConnected());
79 } 79 }
80 80
81 // Tests the case where the type's sync proxy shuts down first. 81 // Tests the case where the type's sync proxy shuts down first.
82 TEST_F(SyncContextProxyImplTest, TypeDisconnectsFirst) { 82 TEST_F(SyncContextProxyImplTest, TypeDisconnectsFirst) {
83 scoped_ptr<syncer::ModelTypeSyncProxyImpl> themes_sync_proxy( 83 scoped_ptr<ModelTypeSyncProxyImpl> themes_sync_proxy(
84 new syncer::ModelTypeSyncProxyImpl(syncer::THEMES)); 84 new ModelTypeSyncProxyImpl(syncer::THEMES));
85 themes_sync_proxy->Enable(GetProxy()); 85 themes_sync_proxy->Enable(GetProxy());
86 86
87 base::RunLoop run_loop_; 87 base::RunLoop run_loop_;
88 run_loop_.RunUntilIdle(); 88 run_loop_.RunUntilIdle();
89 89
90 EXPECT_TRUE(themes_sync_proxy->IsConnected()); 90 EXPECT_TRUE(themes_sync_proxy->IsConnected());
91 themes_sync_proxy.reset(); 91 themes_sync_proxy.reset();
92 } 92 }
93 93
94 // Tests the case where the sync thread shuts down first. 94 // Tests the case where the sync thread shuts down first.
95 TEST_F(SyncContextProxyImplTest, SyncDisconnectsFirst) { 95 TEST_F(SyncContextProxyImplTest, SyncDisconnectsFirst) {
96 scoped_ptr<syncer::ModelTypeSyncProxyImpl> themes_sync_proxy( 96 scoped_ptr<ModelTypeSyncProxyImpl> themes_sync_proxy(
97 new syncer::ModelTypeSyncProxyImpl(syncer::THEMES)); 97 new ModelTypeSyncProxyImpl(syncer::THEMES));
98 themes_sync_proxy->Enable(GetProxy()); 98 themes_sync_proxy->Enable(GetProxy());
99 99
100 base::RunLoop run_loop_; 100 base::RunLoop run_loop_;
101 run_loop_.RunUntilIdle(); 101 run_loop_.RunUntilIdle();
102 102
103 EXPECT_TRUE(themes_sync_proxy->IsConnected()); 103 EXPECT_TRUE(themes_sync_proxy->IsConnected());
104 DisableSync(); 104 DisableSync();
105 } 105 }
106 106
107 } // namespace syncer 107 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_context_proxy_impl.cc ('k') | sync/internal_api/test/null_sync_context_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698