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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/operation_test_base.h

Issue 15972002: Add MoveOperationTest for drive::file_system::MoveOperationTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: I'm stupid Created 7 years, 7 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_
7 7
8 #include <set>
9
8 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
9 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "chrome/browser/chromeos/drive/drive.pb.h"
10 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" 13 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h"
11 #include "chrome/browser/chromeos/drive/test_util.h" 14 #include "chrome/browser/chromeos/drive/test_util.h"
12 #include "content/public/test/test_browser_thread.h" 15 #include "content/public/test/test_browser_thread.h"
13 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
14 17
15 class TestingProfile; 18 class TestingProfile;
16 19
17 namespace base { 20 namespace base {
18 class SequencedTaskRunner; 21 class SequencedTaskRunner;
19 } // namespace base 22 } // namespace base
(...skipping 12 matching lines...) Expand all
32 class ResourceMetadata; 35 class ResourceMetadata;
33 } // namespace internal 36 } // namespace internal
34 37
35 namespace file_system { 38 namespace file_system {
36 39
37 // Base fixture class for testing Drive file system operations. It sets up the 40 // Base fixture class for testing Drive file system operations. It sets up the
38 // basic set of Drive internal classes (ResourceMetadata, Cache, etc) on top of 41 // basic set of Drive internal classes (ResourceMetadata, Cache, etc) on top of
39 // FakeDriveService for testing. 42 // FakeDriveService for testing.
40 class OperationTestBase : public testing::Test { 43 class OperationTestBase : public testing::Test {
41 protected: 44 protected:
42 class DummyObserver : public OperationObserver { 45 // OperationObserver that records all the events.
46 class LoggingObserver : public OperationObserver {
47 public:
48 LoggingObserver();
49 ~LoggingObserver();
50
51 // OperationObserver overrides.
43 virtual void OnDirectoryChangedByOperation( 52 virtual void OnDirectoryChangedByOperation(
44 const base::FilePath& path) OVERRIDE { 53 const base::FilePath& path) OVERRIDE;
54
55 // Gets the set of changed paths.
56 const std::set<base::FilePath>& get_changed_paths() {
57 return changed_paths_;
45 } 58 }
59
60 private:
61 std::set<base::FilePath> changed_paths_;
46 }; 62 };
47 63
48 OperationTestBase(); 64 OperationTestBase();
49 virtual ~OperationTestBase(); 65 virtual ~OperationTestBase();
50 66
51 // testing::Test overrides. 67 // testing::Test overrides.
52 virtual void SetUp() OVERRIDE; 68 virtual void SetUp() OVERRIDE;
53 virtual void TearDown() OVERRIDE; 69 virtual void TearDown() OVERRIDE;
54 70
71 // Synchronously gets the resource entry corresponding to the path from local
72 // ResourceMetadta.
73 FileError GetLocalResourceEntry(const base::FilePath& path,
74 ResourceEntry* entry);
75
76 // Accessors for the components.
55 google_apis::FakeDriveService* fake_service() { 77 google_apis::FakeDriveService* fake_service() {
56 return fake_drive_service_.get(); 78 return fake_drive_service_.get();
57 } 79 }
58 DummyObserver* dummy_observer() { return &dummy_observer_; } 80 LoggingObserver* observer() { return &observer_; }
59 JobScheduler* scheduler() { return scheduler_.get(); } 81 JobScheduler* scheduler() { return scheduler_.get(); }
60 base::SequencedTaskRunner* blocking_task_runner() { 82 base::SequencedTaskRunner* blocking_task_runner() {
61 return blocking_task_runner_; 83 return blocking_task_runner_;
62 } 84 }
63 internal::ResourceMetadata* metadata() { return metadata_.get(); } 85 internal::ResourceMetadata* metadata() { return metadata_.get(); }
64 internal::FileCache* cache() { return cache_.get(); } 86 internal::FileCache* cache() { return cache_.get(); }
65 87
66 private: 88 private:
67 MessageLoopForUI message_loop_; 89 MessageLoopForUI message_loop_;
68 content::TestBrowserThread ui_thread_; 90 content::TestBrowserThread ui_thread_;
69 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 91 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
70 scoped_ptr<TestingProfile> profile_; 92 scoped_ptr<TestingProfile> profile_;
71 base::ScopedTempDir temp_dir_; 93 base::ScopedTempDir temp_dir_;
72 94
73 DummyObserver dummy_observer_; 95 LoggingObserver observer_;
74 scoped_ptr<google_apis::FakeDriveService> fake_drive_service_; 96 scoped_ptr<google_apis::FakeDriveService> fake_drive_service_;
75 scoped_ptr<JobScheduler> scheduler_; 97 scoped_ptr<JobScheduler> scheduler_;
76 scoped_ptr<internal::ResourceMetadata, test_util::DestroyHelperForTests> 98 scoped_ptr<internal::ResourceMetadata, test_util::DestroyHelperForTests>
77 metadata_; 99 metadata_;
78 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; 100 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_;
79 scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_; 101 scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_;
80 }; 102 };
81 103
82 } // namespace file_system 104 } // namespace file_system
83 } // namespace drive 105 } // namespace drive
84 106
85 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ 107 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698