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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/request_manager_unittest.cc

Issue 623293003: replace OVERRIDE and FINAL with override and final in chrome/browser/chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: run git cl format on echo_dialog_view.h 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 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 "chrome/browser/chromeos/file_system_provider/request_manager.h" 5 #include "chrome/browser/chromeos/file_system_provider/request_manager.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 17 matching lines...) Expand all
28 // Fake implementation for the notification manager. Simulates user action on 28 // Fake implementation for the notification manager. Simulates user action on
29 // a notification. 29 // a notification.
30 class FakeNotificationManager : public NotificationManagerInterface { 30 class FakeNotificationManager : public NotificationManagerInterface {
31 public: 31 public:
32 FakeNotificationManager() {} 32 FakeNotificationManager() {}
33 virtual ~FakeNotificationManager() {} 33 virtual ~FakeNotificationManager() {}
34 34
35 // NotificationManagerInterface overrides: 35 // NotificationManagerInterface overrides:
36 virtual void ShowUnresponsiveNotification( 36 virtual void ShowUnresponsiveNotification(
37 int id, 37 int id,
38 const NotificationCallback& callback) OVERRIDE { 38 const NotificationCallback& callback) override {
39 callbacks_[id] = callback; 39 callbacks_[id] = callback;
40 } 40 }
41 41
42 virtual void HideUnresponsiveNotification(int id) OVERRIDE { 42 virtual void HideUnresponsiveNotification(int id) override {
43 callbacks_.erase(id); 43 callbacks_.erase(id);
44 } 44 }
45 45
46 // Aborts all of the virtually shown notifications. 46 // Aborts all of the virtually shown notifications.
47 void Abort() { OnNotificationResult(ABORT); } 47 void Abort() { OnNotificationResult(ABORT); }
48 48
49 // Discards all of the virtually shown notifications. 49 // Discards all of the virtually shown notifications.
50 void Continue() { OnNotificationResult(CONTINUE); } 50 void Continue() { OnNotificationResult(CONTINUE); }
51 51
52 // Returns number of currently shown notifications. 52 // Returns number of currently shown notifications.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Fake handler, which forwards callbacks to the logger. The handler is owned 162 // Fake handler, which forwards callbacks to the logger. The handler is owned
163 // by a request manager, however the logger is owned by tests. 163 // by a request manager, however the logger is owned by tests.
164 class FakeHandler : public RequestManager::HandlerInterface { 164 class FakeHandler : public RequestManager::HandlerInterface {
165 public: 165 public:
166 // The handler can outlive the passed logger, so using a weak pointer. The 166 // The handler can outlive the passed logger, so using a weak pointer. The
167 // |execute_reply| value will be returned for the Execute() call. 167 // |execute_reply| value will be returned for the Execute() call.
168 FakeHandler(base::WeakPtr<EventLogger> logger, bool execute_reply) 168 FakeHandler(base::WeakPtr<EventLogger> logger, bool execute_reply)
169 : logger_(logger), execute_reply_(execute_reply) {} 169 : logger_(logger), execute_reply_(execute_reply) {}
170 170
171 // RequestManager::Handler overrides. 171 // RequestManager::Handler overrides.
172 virtual bool Execute(int request_id) OVERRIDE { 172 virtual bool Execute(int request_id) override {
173 if (logger_.get()) 173 if (logger_.get())
174 logger_->OnExecute(request_id); 174 logger_->OnExecute(request_id);
175 175
176 return execute_reply_; 176 return execute_reply_;
177 } 177 }
178 178
179 // RequestManager::Handler overrides. 179 // RequestManager::Handler overrides.
180 virtual void OnSuccess(int request_id, 180 virtual void OnSuccess(int request_id,
181 scoped_ptr<RequestValue> result, 181 scoped_ptr<RequestValue> result,
182 bool has_more) OVERRIDE { 182 bool has_more) override {
183 if (logger_.get()) 183 if (logger_.get())
184 logger_->OnSuccess(request_id, result.Pass(), has_more); 184 logger_->OnSuccess(request_id, result.Pass(), has_more);
185 } 185 }
186 186
187 // RequestManager::Handler overrides. 187 // RequestManager::Handler overrides.
188 virtual void OnError(int request_id, 188 virtual void OnError(int request_id,
189 scoped_ptr<RequestValue> result, 189 scoped_ptr<RequestValue> result,
190 base::File::Error error) OVERRIDE { 190 base::File::Error error) override {
191 if (logger_.get()) 191 if (logger_.get())
192 logger_->OnError(request_id, result.Pass(), error); 192 logger_->OnError(request_id, result.Pass(), error);
193 } 193 }
194 194
195 virtual ~FakeHandler() {} 195 virtual ~FakeHandler() {}
196 196
197 private: 197 private:
198 base::WeakPtr<EventLogger> logger_; 198 base::WeakPtr<EventLogger> logger_;
199 bool execute_reply_; 199 bool execute_reply_;
200 DISALLOW_COPY_AND_ASSIGN(FakeHandler); 200 DISALLOW_COPY_AND_ASSIGN(FakeHandler);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 base::File::Error error() const { return error_; } 246 base::File::Error error() const { return error_; }
247 247
248 private: 248 private:
249 base::File::Error error_; 249 base::File::Error error_;
250 }; 250 };
251 251
252 RequestObserver() {} 252 RequestObserver() {}
253 virtual ~RequestObserver() {} 253 virtual ~RequestObserver() {}
254 254
255 // RequestManager::Observer overrides. 255 // RequestManager::Observer overrides.
256 virtual void OnRequestCreated(int request_id, RequestType type) OVERRIDE { 256 virtual void OnRequestCreated(int request_id, RequestType type) override {
257 created_.push_back(CreatedEvent(request_id, type)); 257 created_.push_back(CreatedEvent(request_id, type));
258 } 258 }
259 259
260 // RequestManager::Observer overrides. 260 // RequestManager::Observer overrides.
261 virtual void OnRequestDestroyed(int request_id) OVERRIDE { 261 virtual void OnRequestDestroyed(int request_id) override {
262 destroyed_.push_back(Event(request_id)); 262 destroyed_.push_back(Event(request_id));
263 } 263 }
264 264
265 // RequestManager::Observer overrides. 265 // RequestManager::Observer overrides.
266 virtual void OnRequestExecuted(int request_id) OVERRIDE { 266 virtual void OnRequestExecuted(int request_id) override {
267 executed_.push_back(Event(request_id)); 267 executed_.push_back(Event(request_id));
268 } 268 }
269 269
270 // RequestManager::Observer overrides. 270 // RequestManager::Observer overrides.
271 virtual void OnRequestFulfilled(int request_id, 271 virtual void OnRequestFulfilled(int request_id,
272 const RequestValue& result, 272 const RequestValue& result,
273 bool has_more) OVERRIDE { 273 bool has_more) override {
274 fulfilled_.push_back(FulfilledEvent(request_id, has_more)); 274 fulfilled_.push_back(FulfilledEvent(request_id, has_more));
275 } 275 }
276 276
277 // RequestManager::Observer overrides. 277 // RequestManager::Observer overrides.
278 virtual void OnRequestRejected(int request_id, 278 virtual void OnRequestRejected(int request_id,
279 const RequestValue& result, 279 const RequestValue& result,
280 base::File::Error error) OVERRIDE { 280 base::File::Error error) override {
281 rejected_.push_back(RejectedEvent(request_id, error)); 281 rejected_.push_back(RejectedEvent(request_id, error));
282 } 282 }
283 283
284 // RequestManager::Observer overrides. 284 // RequestManager::Observer overrides.
285 virtual void OnRequestTimeouted(int request_id) OVERRIDE { 285 virtual void OnRequestTimeouted(int request_id) override {
286 timeouted_.push_back(Event(request_id)); 286 timeouted_.push_back(Event(request_id));
287 } 287 }
288 288
289 const std::vector<CreatedEvent>& created() const { return created_; } 289 const std::vector<CreatedEvent>& created() const { return created_; }
290 const std::vector<Event>& destroyed() const { return destroyed_; } 290 const std::vector<Event>& destroyed() const { return destroyed_; }
291 const std::vector<Event>& executed() const { return executed_; } 291 const std::vector<Event>& executed() const { return executed_; }
292 const std::vector<FulfilledEvent>& fulfilled() const { return fulfilled_; } 292 const std::vector<FulfilledEvent>& fulfilled() const { return fulfilled_; }
293 const std::vector<RejectedEvent>& rejected() const { return rejected_; } 293 const std::vector<RejectedEvent>& rejected() const { return rejected_; }
294 const std::vector<Event>& timeouted() const { return timeouted_; } 294 const std::vector<Event>& timeouted() const { return timeouted_; }
295 295
296 private: 296 private:
297 std::vector<CreatedEvent> created_; 297 std::vector<CreatedEvent> created_;
298 std::vector<Event> destroyed_; 298 std::vector<Event> destroyed_;
299 std::vector<Event> executed_; 299 std::vector<Event> executed_;
300 std::vector<FulfilledEvent> fulfilled_; 300 std::vector<FulfilledEvent> fulfilled_;
301 std::vector<RejectedEvent> rejected_; 301 std::vector<RejectedEvent> rejected_;
302 std::vector<Event> timeouted_; 302 std::vector<Event> timeouted_;
303 303
304 DISALLOW_COPY_AND_ASSIGN(RequestObserver); 304 DISALLOW_COPY_AND_ASSIGN(RequestObserver);
305 }; 305 };
306 306
307 } // namespace 307 } // namespace
308 308
309 class FileSystemProviderRequestManagerTest : public testing::Test { 309 class FileSystemProviderRequestManagerTest : public testing::Test {
310 protected: 310 protected:
311 FileSystemProviderRequestManagerTest() {} 311 FileSystemProviderRequestManagerTest() {}
312 virtual ~FileSystemProviderRequestManagerTest() {} 312 virtual ~FileSystemProviderRequestManagerTest() {}
313 313
314 virtual void SetUp() OVERRIDE { 314 virtual void SetUp() override {
315 notification_manager_.reset(new FakeNotificationManager); 315 notification_manager_.reset(new FakeNotificationManager);
316 request_manager_.reset(new RequestManager(notification_manager_.get())); 316 request_manager_.reset(new RequestManager(notification_manager_.get()));
317 } 317 }
318 318
319 content::TestBrowserThreadBundle thread_bundle_; 319 content::TestBrowserThreadBundle thread_bundle_;
320 scoped_ptr<FakeNotificationManager> notification_manager_; 320 scoped_ptr<FakeNotificationManager> notification_manager_;
321 scoped_ptr<RequestManager> request_manager_; 321 scoped_ptr<RequestManager> request_manager_;
322 }; 322 };
323 323
324 TEST_F(FileSystemProviderRequestManagerTest, CreateFailure) { 324 TEST_F(FileSystemProviderRequestManagerTest, CreateFailure) {
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 799
800 // Wait until the request is timeouted again. 800 // Wait until the request is timeouted again.
801 base::RunLoop().RunUntilIdle(); 801 base::RunLoop().RunUntilIdle();
802 EXPECT_EQ(1u, notification_manager_->size()); 802 EXPECT_EQ(1u, notification_manager_->size());
803 803
804 request_manager_->RemoveObserver(&observer); 804 request_manager_->RemoveObserver(&observer);
805 } 805 }
806 806
807 } // namespace file_system_provider 807 } // namespace file_system_provider
808 } // namespace chromeos 808 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698