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

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

Issue 629603002: replace OVERRIDE and FINAL with override and final in chrome/browser/[r-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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 (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/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 24 matching lines...) Expand all
35 namespace { 35 namespace {
36 36
37 using content::BrowserThread; 37 using content::BrowserThread;
38 using testing::_; 38 using testing::_;
39 using testing::Return; 39 using testing::Return;
40 40
41 class NoOpAutofillBackend : public AutofillWebDataBackend { 41 class NoOpAutofillBackend : public AutofillWebDataBackend {
42 public: 42 public:
43 NoOpAutofillBackend() {} 43 NoOpAutofillBackend() {}
44 virtual ~NoOpAutofillBackend() {} 44 virtual ~NoOpAutofillBackend() {}
45 virtual WebDatabase* GetDatabase() OVERRIDE { return NULL; } 45 virtual WebDatabase* GetDatabase() override { return NULL; }
46 virtual void AddObserver( 46 virtual void AddObserver(
47 autofill::AutofillWebDataServiceObserverOnDBThread* observer) OVERRIDE {} 47 autofill::AutofillWebDataServiceObserverOnDBThread* observer) override {}
48 virtual void RemoveObserver( 48 virtual void RemoveObserver(
49 autofill::AutofillWebDataServiceObserverOnDBThread* observer) OVERRIDE {} 49 autofill::AutofillWebDataServiceObserverOnDBThread* observer) override {}
50 virtual void RemoveExpiredFormElements() OVERRIDE {} 50 virtual void RemoveExpiredFormElements() override {}
51 virtual void NotifyOfMultipleAutofillChanges() OVERRIDE {} 51 virtual void NotifyOfMultipleAutofillChanges() override {}
52 }; 52 };
53 53
54 // Fake WebDataService implementation that stubs out the database loading. 54 // Fake WebDataService implementation that stubs out the database loading.
55 class FakeWebDataService : public AutofillWebDataService { 55 class FakeWebDataService : public AutofillWebDataService {
56 public: 56 public:
57 FakeWebDataService() 57 FakeWebDataService()
58 : AutofillWebDataService( 58 : AutofillWebDataService(
59 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 59 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
60 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)), 60 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)),
61 is_database_loaded_(false), 61 is_database_loaded_(false),
62 db_loaded_callback_(base::Callback<void(void)>()){} 62 db_loaded_callback_(base::Callback<void(void)>()){}
63 63
64 // Mark the database as loaded and send out the appropriate notification. 64 // Mark the database as loaded and send out the appropriate notification.
65 void LoadDatabase() { 65 void LoadDatabase() {
66 StartSyncableService(); 66 StartSyncableService();
67 is_database_loaded_ = true; 67 is_database_loaded_ = true;
68 68
69 if (!db_loaded_callback_.is_null()) 69 if (!db_loaded_callback_.is_null())
70 db_loaded_callback_.Run(); 70 db_loaded_callback_.Run();
71 } 71 }
72 72
73 virtual bool IsDatabaseLoaded() OVERRIDE { 73 virtual bool IsDatabaseLoaded() override {
74 return is_database_loaded_; 74 return is_database_loaded_;
75 } 75 }
76 76
77 virtual void RegisterDBLoadedCallback( 77 virtual void RegisterDBLoadedCallback(
78 const base::Callback<void(void)>& callback) OVERRIDE { 78 const base::Callback<void(void)>& callback) override {
79 db_loaded_callback_ = callback; 79 db_loaded_callback_ = callback;
80 } 80 }
81 81
82 void StartSyncableService() { 82 void StartSyncableService() {
83 // The |autofill_profile_syncable_service_| must be constructed on the DB 83 // The |autofill_profile_syncable_service_| must be constructed on the DB
84 // thread. 84 // thread.
85 base::RunLoop run_loop; 85 base::RunLoop run_loop;
86 BrowserThread::PostTaskAndReply(BrowserThread::DB, FROM_HERE, 86 BrowserThread::PostTaskAndReply(BrowserThread::DB, FROM_HERE,
87 base::Bind(&FakeWebDataService::CreateSyncableService, 87 base::Bind(&FakeWebDataService::CreateSyncableService,
88 base::Unretained(this)), run_loop.QuitClosure()); 88 base::Unretained(this)), run_loop.QuitClosure());
(...skipping 22 matching lines...) Expand all
111 class MockWebDataServiceWrapperSyncable : public MockWebDataServiceWrapper { 111 class MockWebDataServiceWrapperSyncable : public MockWebDataServiceWrapper {
112 public: 112 public:
113 static KeyedService* Build(content::BrowserContext* profile) { 113 static KeyedService* Build(content::BrowserContext* profile) {
114 return new MockWebDataServiceWrapperSyncable(); 114 return new MockWebDataServiceWrapperSyncable();
115 } 115 }
116 116
117 MockWebDataServiceWrapperSyncable() 117 MockWebDataServiceWrapperSyncable()
118 : MockWebDataServiceWrapper(new FakeWebDataService(), NULL) { 118 : MockWebDataServiceWrapper(new FakeWebDataService(), NULL) {
119 } 119 }
120 120
121 virtual void Shutdown() OVERRIDE { 121 virtual void Shutdown() override {
122 static_cast<FakeWebDataService*>( 122 static_cast<FakeWebDataService*>(
123 fake_autofill_web_data_.get())->ShutdownOnUIThread(); 123 fake_autofill_web_data_.get())->ShutdownOnUIThread();
124 // Make sure WebDataService is shutdown properly on DB thread before we 124 // Make sure WebDataService is shutdown properly on DB thread before we
125 // destroy it. 125 // destroy it.
126 base::RunLoop run_loop; 126 base::RunLoop run_loop;
127 ASSERT_TRUE(BrowserThread::PostTaskAndReply(BrowserThread::DB, FROM_HERE, 127 ASSERT_TRUE(BrowserThread::PostTaskAndReply(BrowserThread::DB, FROM_HERE,
128 base::Bind(&base::DoNothing), run_loop.QuitClosure())); 128 base::Bind(&base::DoNothing), run_loop.QuitClosure()));
129 run_loop.Run(); 129 run_loop.Run();
130 } 130 }
131 131
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 EXPECT_EQ(sync_driver::DataTypeController::ASSOCIATION_FAILED, 244 EXPECT_EQ(sync_driver::DataTypeController::ASSOCIATION_FAILED,
245 last_start_result_); 245 last_start_result_);
246 EXPECT_TRUE(last_start_error_.IsSet()); 246 EXPECT_TRUE(last_start_error_.IsSet());
247 247
248 EXPECT_EQ(sync_driver::DataTypeController::DISABLED, autofill_dtc_->state()); 248 EXPECT_EQ(sync_driver::DataTypeController::DISABLED, autofill_dtc_->state());
249 } 249 }
250 250
251 } // namespace 251 } // namespace
252 252
253 } // namespace browser_sync 253 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698