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

Side by Side Diff: components/sync_driver/model_association_manager_unittest.cc

Issue 133503011: Move files from //chrome/browser/sync to sync_driver component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "base/callback.h" 5 #include "base/callback.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "chrome/browser/sync/glue/model_association_manager.h"
8 #include "components/sync_driver/fake_data_type_controller.h" 7 #include "components/sync_driver/fake_data_type_controller.h"
9 #include "content/public/test/test_browser_thread.h" 8 #include "components/sync_driver/model_association_manager.h"
10 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
12 11
13 using ::testing::_; 12 using ::testing::_;
14 namespace browser_sync { 13 namespace browser_sync {
15 class MockModelAssociationResultProcessor : 14 class MockModelAssociationResultProcessor :
16 public ModelAssociationResultProcessor { 15 public ModelAssociationResultProcessor {
17 public: 16 public:
18 MockModelAssociationResultProcessor() {} 17 MockModelAssociationResultProcessor() {}
19 ~MockModelAssociationResultProcessor() {} 18 ~MockModelAssociationResultProcessor() {}
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 EXPECT_EQ((*it1).first, (*it2).first); 50 EXPECT_EQ((*it1).first, (*it2).first);
52 } 51 }
53 } 52 }
54 53
55 EXPECT_TRUE(arg0.unfinished_data_types.Equals( 54 EXPECT_TRUE(arg0.unfinished_data_types.Equals(
56 expected_result.unfinished_data_types)); 55 expected_result.unfinished_data_types));
57 } 56 }
58 57
59 class SyncModelAssociationManagerTest : public testing::Test { 58 class SyncModelAssociationManagerTest : public testing::Test {
60 public: 59 public:
61 SyncModelAssociationManagerTest() : 60 SyncModelAssociationManagerTest() {
62 ui_thread_(content::BrowserThread::UI, &ui_loop_) {
63 } 61 }
64 62
65 protected: 63 protected:
66 base::MessageLoopForUI ui_loop_; 64 base::MessageLoopForUI ui_loop_;
67 content::TestBrowserThread ui_thread_;
68 MockModelAssociationResultProcessor result_processor_; 65 MockModelAssociationResultProcessor result_processor_;
69 DataTypeController::TypeMap controllers_; 66 DataTypeController::TypeMap controllers_;
70 }; 67 };
71 68
72 // Start a type and make sure ModelAssociationManager callst the |Start| 69 // Start a type and make sure ModelAssociationManager callst the |Start|
73 // method and calls the callback when it is done. 70 // method and calls the callback when it is done.
74 TEST_F(SyncModelAssociationManagerTest, SimpleModelStart) { 71 TEST_F(SyncModelAssociationManagerTest, SimpleModelStart) {
75 controllers_[syncer::BOOKMARKS] = 72 controllers_[syncer::BOOKMARKS] =
76 new FakeDataTypeController(syncer::BOOKMARKS); 73 new FakeDataTypeController(syncer::BOOKMARKS);
77 controllers_[syncer::APPS] = 74 controllers_[syncer::APPS] =
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 377
381 model_association_manager.Initialize(types); 378 model_association_manager.Initialize(types);
382 EXPECT_EQ(DataTypeController::DISABLED, 379 EXPECT_EQ(DataTypeController::DISABLED,
383 GetController(controllers_, syncer::BOOKMARKS)->state()); 380 GetController(controllers_, syncer::BOOKMARKS)->state());
384 model_association_manager.StartAssociationAsync(types); 381 model_association_manager.StartAssociationAsync(types);
385 EXPECT_EQ(DataTypeController::NOT_RUNNING, 382 EXPECT_EQ(DataTypeController::NOT_RUNNING,
386 GetController(controllers_, syncer::BOOKMARKS)->state()); 383 GetController(controllers_, syncer::BOOKMARKS)->state());
387 } 384 }
388 385
389 } // namespace browser_sync 386 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698