OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 WaitableEvent* done_event_; | 80 WaitableEvent* done_event_; |
81 }; | 81 }; |
82 | 82 |
83 class AutofillDataTypeControllerTest : public testing::Test { | 83 class AutofillDataTypeControllerTest : public testing::Test { |
84 public: | 84 public: |
85 AutofillDataTypeControllerTest() | 85 AutofillDataTypeControllerTest() |
86 : ui_thread_(BrowserThread::UI, &message_loop_), | 86 : ui_thread_(BrowserThread::UI, &message_loop_), |
87 db_thread_(BrowserThread::DB) {} | 87 db_thread_(BrowserThread::DB) {} |
88 | 88 |
89 virtual void SetUp() { | 89 virtual void SetUp() { |
| 90 EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly( |
| 91 Return(&service_)); |
90 db_thread_.Start(); | 92 db_thread_.Start(); |
91 web_data_service_ = new WebDataServiceFake(true); | 93 web_data_service_ = new WebDataServiceFake(true); |
92 personal_data_manager_ = new PersonalDataManagerMock(); | 94 personal_data_manager_ = new PersonalDataManagerMock(); |
93 autofill_dtc_ = | 95 autofill_dtc_ = |
94 new AutofillDataTypeController(&profile_sync_factory_, | 96 new AutofillDataTypeController(&profile_sync_factory_, |
95 &profile_, | 97 &profile_); |
96 &service_); | |
97 } | 98 } |
98 | 99 |
99 virtual void TearDown() { | 100 virtual void TearDown() { |
100 WaitForEmptyDBMessageLoop(); | 101 WaitForEmptyDBMessageLoop(); |
101 db_thread_.Stop(); | 102 db_thread_.Stop(); |
102 } | 103 } |
103 | 104 |
104 protected: | 105 protected: |
105 void SetStartExpectations() { | 106 void SetStartExpectations() { |
106 EXPECT_CALL(profile_, GetPersonalDataManager()). | 107 EXPECT_CALL(profile_, GetPersonalDataManager()). |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 wait_for_db_thread_pause.Wait(); | 279 wait_for_db_thread_pause.Wait(); |
279 EXPECT_EQ(DataTypeController::ASSOCIATING, autofill_dtc_->state()); | 280 EXPECT_EQ(DataTypeController::ASSOCIATING, autofill_dtc_->state()); |
280 | 281 |
281 SetStopExpectations(); | 282 SetStopExpectations(); |
282 EXPECT_CALL(start_callback_, Run(DataTypeController::ABORTED, _)); | 283 EXPECT_CALL(start_callback_, Run(DataTypeController::ABORTED, _)); |
283 autofill_dtc_->Stop(); | 284 autofill_dtc_->Stop(); |
284 EXPECT_EQ(DataTypeController::NOT_RUNNING, autofill_dtc_->state()); | 285 EXPECT_EQ(DataTypeController::NOT_RUNNING, autofill_dtc_->state()); |
285 } | 286 } |
286 | 287 |
287 } // namespace | 288 } // namespace |
OLD | NEW |