OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 void clear_changed_files() { changed_files_.ClearForTest(); } | 44 void clear_changed_files() { changed_files_.ClearForTest(); } |
45 | 45 |
46 int load_from_server_complete_count() const { | 46 int load_from_server_complete_count() const { |
47 return load_from_server_complete_count_; | 47 return load_from_server_complete_count_; |
48 } | 48 } |
49 int initial_load_complete_count() const { | 49 int initial_load_complete_count() const { |
50 return initial_load_complete_count_; | 50 return initial_load_complete_count_; |
51 } | 51 } |
52 | 52 |
53 // ChageListObserver overrides: | 53 // ChageListObserver overrides: |
54 virtual void OnFileChanged(const FileChange& changed_files) OVERRIDE { | 54 virtual void OnFileChanged(const FileChange& changed_files) override { |
55 changed_files_.Apply(changed_files); | 55 changed_files_.Apply(changed_files); |
56 } | 56 } |
57 virtual void OnLoadFromServerComplete() OVERRIDE { | 57 virtual void OnLoadFromServerComplete() override { |
58 ++load_from_server_complete_count_; | 58 ++load_from_server_complete_count_; |
59 } | 59 } |
60 virtual void OnInitialLoadComplete() OVERRIDE { | 60 virtual void OnInitialLoadComplete() override { |
61 ++initial_load_complete_count_; | 61 ++initial_load_complete_count_; |
62 } | 62 } |
63 | 63 |
64 private: | 64 private: |
65 ChangeListLoader* loader_; | 65 ChangeListLoader* loader_; |
66 FileChange changed_files_; | 66 FileChange changed_files_; |
67 int load_from_server_complete_count_; | 67 int load_from_server_complete_count_; |
68 int initial_load_complete_count_; | 68 int initial_load_complete_count_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(TestChangeListLoaderObserver); | 70 DISALLOW_COPY_AND_ASSIGN(TestChangeListLoaderObserver); |
71 }; | 71 }; |
72 | 72 |
73 class ChangeListLoaderTest : public testing::Test { | 73 class ChangeListLoaderTest : public testing::Test { |
74 protected: | 74 protected: |
75 virtual void SetUp() OVERRIDE { | 75 virtual void SetUp() override { |
76 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 76 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
77 pref_service_.reset(new TestingPrefServiceSimple); | 77 pref_service_.reset(new TestingPrefServiceSimple); |
78 test_util::RegisterDrivePrefs(pref_service_->registry()); | 78 test_util::RegisterDrivePrefs(pref_service_->registry()); |
79 | 79 |
80 logger_.reset(new EventLogger); | 80 logger_.reset(new EventLogger); |
81 | 81 |
82 drive_service_.reset(new FakeDriveService); | 82 drive_service_.reset(new FakeDriveService); |
83 ASSERT_TRUE(test_util::SetUpTestEntries(drive_service_.get())); | 83 ASSERT_TRUE(test_util::SetUpTestEntries(drive_service_.get())); |
84 | 84 |
85 scheduler_.reset(new JobScheduler(pref_service_.get(), | 85 scheduler_.reset(new JobScheduler(pref_service_.get(), |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 // Unlock the loader, this should resume the pending update. | 394 // Unlock the loader, this should resume the pending update. |
395 lock.reset(); | 395 lock.reset(); |
396 base::RunLoop().RunUntilIdle(); | 396 base::RunLoop().RunUntilIdle(); |
397 EXPECT_TRUE( | 397 EXPECT_TRUE( |
398 observer.changed_files().CountDirectory(util::GetDriveMyDriveRootPath())); | 398 observer.changed_files().CountDirectory(util::GetDriveMyDriveRootPath())); |
399 } | 399 } |
400 | 400 |
401 } // namespace internal | 401 } // namespace internal |
402 } // namespace drive | 402 } // namespace drive |
OLD | NEW |