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

Side by Side Diff: chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc

Issue 408003002: [Sync] Fix namespace for sync_driver component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/test/test_timeouts.h" 14 #include "base/test/test_timeouts.h"
15 #include "base/tracked_objects.h" 15 #include "base/tracked_objects.h"
16 #include "chrome/browser/sync/glue/non_frontend_data_type_controller.h" 16 #include "chrome/browser/sync/glue/non_frontend_data_type_controller.h"
17 #include "chrome/browser/sync/glue/non_frontend_data_type_controller_mock.h" 17 #include "chrome/browser/sync/glue/non_frontend_data_type_controller_mock.h"
18 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" 18 #include "chrome/browser/sync/profile_sync_components_factory_mock.h"
19 #include "chrome/browser/sync/profile_sync_service_mock.h" 19 #include "chrome/browser/sync/profile_sync_service_mock.h"
20 #include "chrome/test/base/profile_mock.h" 20 #include "chrome/test/base/profile_mock.h"
21 #include "components/sync_driver/change_processor_mock.h" 21 #include "components/sync_driver/change_processor_mock.h"
22 #include "components/sync_driver/data_type_controller_mock.h" 22 #include "components/sync_driver/data_type_controller_mock.h"
23 #include "components/sync_driver/model_associator_mock.h" 23 #include "components/sync_driver/model_associator_mock.h"
24 #include "content/public/test/test_browser_thread.h" 24 #include "content/public/test/test_browser_thread.h"
25 #include "sync/internal_api/public/engine/model_safe_worker.h" 25 #include "sync/internal_api/public/engine/model_safe_worker.h"
26 26
27 using base::WaitableEvent; 27 using base::WaitableEvent;
28 using browser_sync::ChangeProcessorMock;
29 using browser_sync::DataTypeController;
30 using syncer::GROUP_DB; 28 using syncer::GROUP_DB;
31 using browser_sync::NonFrontendDataTypeController; 29 using browser_sync::NonFrontendDataTypeController;
32 using browser_sync::NonFrontendDataTypeControllerMock; 30 using browser_sync::NonFrontendDataTypeControllerMock;
33 using browser_sync::ModelAssociatorMock; 31 using sync_driver::ChangeProcessorMock;
34 using browser_sync::ModelLoadCallbackMock; 32 using sync_driver::DataTypeController;
35 using browser_sync::StartCallbackMock; 33 using sync_driver::ModelAssociatorMock;
34 using sync_driver::ModelLoadCallbackMock;
35 using sync_driver::StartCallbackMock;
36 using content::BrowserThread; 36 using content::BrowserThread;
37 using testing::_; 37 using testing::_;
38 using testing::DoAll; 38 using testing::DoAll;
39 using testing::InvokeWithoutArgs; 39 using testing::InvokeWithoutArgs;
40 using testing::Return; 40 using testing::Return;
41 using testing::SetArgumentPointee; 41 using testing::SetArgumentPointee;
42 using testing::StrictMock; 42 using testing::StrictMock;
43 43
44 ACTION_P(WaitOnEvent, event) { 44 ACTION_P(WaitOnEvent, event) {
45 event->Wait(); 45 event->Wait();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 mock_->RecordUnrecoverableError(from_here, message); 94 mock_->RecordUnrecoverableError(from_here, message);
95 } 95 }
96 virtual void RecordAssociationTime(base::TimeDelta time) OVERRIDE { 96 virtual void RecordAssociationTime(base::TimeDelta time) OVERRIDE {
97 mock_->RecordAssociationTime(time); 97 mock_->RecordAssociationTime(time);
98 } 98 }
99 virtual void RecordStartFailure( 99 virtual void RecordStartFailure(
100 DataTypeController::StartResult result) OVERRIDE { 100 DataTypeController::StartResult result) OVERRIDE {
101 mock_->RecordStartFailure(result); 101 mock_->RecordStartFailure(result);
102 } 102 }
103 virtual void DisconnectProcessor( 103 virtual void DisconnectProcessor(
104 browser_sync::ChangeProcessor* processor) OVERRIDE{ 104 sync_driver::ChangeProcessor* processor) OVERRIDE{
105 mock_->DisconnectProcessor(processor); 105 mock_->DisconnectProcessor(processor);
106 } 106 }
107 107
108 private: 108 private:
109 NonFrontendDataTypeControllerMock* mock_; 109 NonFrontendDataTypeControllerMock* mock_;
110 }; 110 };
111 111
112 class SyncNonFrontendDataTypeControllerTest : public testing::Test { 112 class SyncNonFrontendDataTypeControllerTest : public testing::Test {
113 public: 113 public:
114 SyncNonFrontendDataTypeControllerTest() 114 SyncNonFrontendDataTypeControllerTest()
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 EXPECT_EQ(DataTypeController::RUNNING, non_frontend_dtc_->state()); 388 EXPECT_EQ(DataTypeController::RUNNING, non_frontend_dtc_->state());
389 // This should cause non_frontend_dtc_->Stop() to be called. 389 // This should cause non_frontend_dtc_->Stop() to be called.
390 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind( 390 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind(
391 &NonFrontendDataTypeControllerFake::OnSingleDatatypeUnrecoverableError, 391 &NonFrontendDataTypeControllerFake::OnSingleDatatypeUnrecoverableError,
392 non_frontend_dtc_.get(), 392 non_frontend_dtc_.get(),
393 FROM_HERE, 393 FROM_HERE,
394 std::string("Test"))); 394 std::string("Test")));
395 WaitForDTC(); 395 WaitForDTC();
396 EXPECT_EQ(DataTypeController::NOT_RUNNING, non_frontend_dtc_->state()); 396 EXPECT_EQ(DataTypeController::NOT_RUNNING, non_frontend_dtc_->state());
397 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698