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

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

Issue 249843002: Introduce NonBlockingDataTypeController (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix one nit Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « sync/internal_api/public/non_blocking_type_processor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_loop/message_loop_proxy.h" 6 #include "base/message_loop/message_loop_proxy.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/sequenced_task_runner.h" 8 #include "base/sequenced_task_runner.h"
9 #include "sync/internal_api/public/base/model_type.h" 9 #include "sync/internal_api/public/base/model_type.h"
10 #include "sync/internal_api/public/non_blocking_type_processor.h" 10 #include "sync/internal_api/public/non_blocking_type_processor.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 }; 45 };
46 46
47 // Try to connect a type to a SyncCore that has already shut down. 47 // Try to connect a type to a SyncCore that has already shut down.
48 TEST_F(SyncCoreProxyImplTest, FailToConnect1) { 48 TEST_F(SyncCoreProxyImplTest, FailToConnect1) {
49 NonBlockingTypeProcessor themes_processor(syncer::THEMES); 49 NonBlockingTypeProcessor themes_processor(syncer::THEMES);
50 DisableSync(); 50 DisableSync();
51 themes_processor.Enable(GetProxy()); 51 themes_processor.Enable(GetProxy());
52 52
53 base::RunLoop run_loop_; 53 base::RunLoop run_loop_;
54 run_loop_.RunUntilIdle(); 54 run_loop_.RunUntilIdle();
55 EXPECT_FALSE(themes_processor.IsEnabled()); 55 EXPECT_FALSE(themes_processor.IsConnected());
56 } 56 }
57 57
58 // Try to connect a type to a SyncCore as it shuts down. 58 // Try to connect a type to a SyncCore as it shuts down.
59 TEST_F(SyncCoreProxyImplTest, FailToConnect2) { 59 TEST_F(SyncCoreProxyImplTest, FailToConnect2) {
60 NonBlockingTypeProcessor themes_processor(syncer::THEMES); 60 NonBlockingTypeProcessor themes_processor(syncer::THEMES);
61 themes_processor.Enable(GetProxy()); 61 themes_processor.Enable(GetProxy());
62 DisableSync(); 62 DisableSync();
63 63
64 base::RunLoop run_loop_; 64 base::RunLoop run_loop_;
65 run_loop_.RunUntilIdle(); 65 run_loop_.RunUntilIdle();
66 EXPECT_FALSE(themes_processor.IsEnabled()); 66 EXPECT_FALSE(themes_processor.IsConnected());
67 } 67 }
68 68
69 // Tests the case where the type's processor shuts down first. 69 // Tests the case where the type's processor shuts down first.
70 TEST_F(SyncCoreProxyImplTest, TypeDisconnectsFirst) { 70 TEST_F(SyncCoreProxyImplTest, TypeDisconnectsFirst) {
71 scoped_ptr<NonBlockingTypeProcessor> themes_processor 71 scoped_ptr<NonBlockingTypeProcessor> themes_processor
72 (new NonBlockingTypeProcessor(syncer::THEMES)); 72 (new NonBlockingTypeProcessor(syncer::THEMES));
73 themes_processor->Enable(GetProxy()); 73 themes_processor->Enable(GetProxy());
74 74
75 base::RunLoop run_loop_; 75 base::RunLoop run_loop_;
76 run_loop_.RunUntilIdle(); 76 run_loop_.RunUntilIdle();
77 77
78 EXPECT_TRUE(themes_processor->IsEnabled()); 78 EXPECT_TRUE(themes_processor->IsConnected());
79 themes_processor.reset(); 79 themes_processor.reset();
80 } 80 }
81 81
82 // Tests the case where the sync thread shuts down first. 82 // Tests the case where the sync thread shuts down first.
83 TEST_F(SyncCoreProxyImplTest, SyncDisconnectsFirst) { 83 TEST_F(SyncCoreProxyImplTest, SyncDisconnectsFirst) {
84 scoped_ptr<NonBlockingTypeProcessor> themes_processor 84 scoped_ptr<NonBlockingTypeProcessor> themes_processor
85 (new NonBlockingTypeProcessor(syncer::THEMES)); 85 (new NonBlockingTypeProcessor(syncer::THEMES));
86 themes_processor->Enable(GetProxy()); 86 themes_processor->Enable(GetProxy());
87 87
88 base::RunLoop run_loop_; 88 base::RunLoop run_loop_;
89 run_loop_.RunUntilIdle(); 89 run_loop_.RunUntilIdle();
90 90
91 EXPECT_TRUE(themes_processor->IsEnabled()); 91 EXPECT_TRUE(themes_processor->IsConnected());
92 DisableSync(); 92 DisableSync();
93 } 93 }
94 94
95 } // namespace syncer 95 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/non_blocking_type_processor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698