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

Side by Side Diff: chrome/browser/chromeos/drive/change_list_loader_unittest.cc

Issue 817063006: Update {virtual,override,final} to follow C++11 style in chrome/browser/chromeos/drive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/drive/change_list_loader.h" 5 #include "chrome/browser/chromeos/drive/change_list_loader.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
(...skipping 18 matching lines...) Expand all
29 29
30 class TestChangeListLoaderObserver : public ChangeListLoaderObserver { 30 class TestChangeListLoaderObserver : public ChangeListLoaderObserver {
31 public: 31 public:
32 explicit TestChangeListLoaderObserver(ChangeListLoader* loader) 32 explicit TestChangeListLoaderObserver(ChangeListLoader* loader)
33 : loader_(loader), 33 : loader_(loader),
34 load_from_server_complete_count_(0), 34 load_from_server_complete_count_(0),
35 initial_load_complete_count_(0) { 35 initial_load_complete_count_(0) {
36 loader_->AddObserver(this); 36 loader_->AddObserver(this);
37 } 37 }
38 38
39 virtual ~TestChangeListLoaderObserver() { 39 ~TestChangeListLoaderObserver() override { loader_->RemoveObserver(this); }
hashimoto 2015/01/21 04:50:12 nit: I think RemoveObserver should be better place
40 loader_->RemoveObserver(this);
41 }
42 40
43 const FileChange& changed_files() const { return changed_files_; } 41 const FileChange& changed_files() const { return changed_files_; }
44 void clear_changed_files() { changed_files_.ClearForTest(); } 42 void clear_changed_files() { changed_files_.ClearForTest(); }
45 43
46 int load_from_server_complete_count() const { 44 int load_from_server_complete_count() const {
47 return load_from_server_complete_count_; 45 return load_from_server_complete_count_;
48 } 46 }
49 int initial_load_complete_count() const { 47 int initial_load_complete_count() const {
50 return initial_load_complete_count_; 48 return initial_load_complete_count_;
51 } 49 }
52 50
53 // ChageListObserver overrides: 51 // ChageListObserver overrides:
54 virtual void OnFileChanged(const FileChange& changed_files) override { 52 void OnFileChanged(const FileChange& changed_files) override {
55 changed_files_.Apply(changed_files); 53 changed_files_.Apply(changed_files);
56 } 54 }
57 virtual void OnLoadFromServerComplete() override { 55 void OnLoadFromServerComplete() override {
58 ++load_from_server_complete_count_; 56 ++load_from_server_complete_count_;
59 } 57 }
60 virtual void OnInitialLoadComplete() override { 58 void OnInitialLoadComplete() override { ++initial_load_complete_count_; }
hashimoto 2015/01/21 04:50:12 ditto.
61 ++initial_load_complete_count_;
62 }
63 59
64 private: 60 private:
65 ChangeListLoader* loader_; 61 ChangeListLoader* loader_;
66 FileChange changed_files_; 62 FileChange changed_files_;
67 int load_from_server_complete_count_; 63 int load_from_server_complete_count_;
68 int initial_load_complete_count_; 64 int initial_load_complete_count_;
69 65
70 DISALLOW_COPY_AND_ASSIGN(TestChangeListLoaderObserver); 66 DISALLOW_COPY_AND_ASSIGN(TestChangeListLoaderObserver);
71 }; 67 };
72 68
73 class ChangeListLoaderTest : public testing::Test { 69 class ChangeListLoaderTest : public testing::Test {
74 protected: 70 protected:
75 virtual void SetUp() override { 71 void SetUp() override {
76 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 72 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
77 pref_service_.reset(new TestingPrefServiceSimple); 73 pref_service_.reset(new TestingPrefServiceSimple);
78 test_util::RegisterDrivePrefs(pref_service_->registry()); 74 test_util::RegisterDrivePrefs(pref_service_->registry());
79 75
80 logger_.reset(new EventLogger); 76 logger_.reset(new EventLogger);
81 77
82 drive_service_.reset(new FakeDriveService); 78 drive_service_.reset(new FakeDriveService);
83 ASSERT_TRUE(test_util::SetUpTestEntries(drive_service_.get())); 79 ASSERT_TRUE(test_util::SetUpTestEntries(drive_service_.get()));
84 80
85 scheduler_.reset(new JobScheduler(pref_service_.get(), 81 scheduler_.reset(new JobScheduler(pref_service_.get(),
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 389
394 // Unlock the loader, this should resume the pending update. 390 // Unlock the loader, this should resume the pending update.
395 lock.reset(); 391 lock.reset();
396 base::RunLoop().RunUntilIdle(); 392 base::RunLoop().RunUntilIdle();
397 EXPECT_TRUE( 393 EXPECT_TRUE(
398 observer.changed_files().CountDirectory(util::GetDriveMyDriveRootPath())); 394 observer.changed_files().CountDirectory(util::GetDriveMyDriveRootPath()));
399 } 395 }
400 396
401 } // namespace internal 397 } // namespace internal
402 } // namespace drive 398 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698