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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 class TestITunesDataProvider : public ITunesDataProvider { | 67 class TestITunesDataProvider : public ITunesDataProvider { |
68 public: | 68 public: |
69 explicit TestITunesDataProvider(const base::FilePath& fake_library_path) | 69 explicit TestITunesDataProvider(const base::FilePath& fake_library_path) |
70 : ITunesDataProvider(fake_library_path) { | 70 : ITunesDataProvider(fake_library_path) { |
71 EXPECT_TRUE(fake_auto_add_dir_.CreateUniqueTempDir()); | 71 EXPECT_TRUE(fake_auto_add_dir_.CreateUniqueTempDir()); |
72 } | 72 } |
73 | 73 |
74 virtual ~TestITunesDataProvider() {} | 74 ~TestITunesDataProvider() override {} |
75 | 75 |
76 virtual void RefreshData(const ReadyCallback& ready_callback) override { | 76 void RefreshData(const ReadyCallback& ready_callback) override { |
77 ready_callback.Run(true /* success */); | 77 ready_callback.Run(true /* success */); |
78 } | 78 } |
79 | 79 |
80 virtual const base::FilePath& auto_add_path() const override { | 80 const base::FilePath& auto_add_path() const override { |
81 return fake_auto_add_dir_.path(); | 81 return fake_auto_add_dir_.path(); |
82 } | 82 } |
83 | 83 |
84 void SetProvideAutoAddDir(bool provide_auto_add_dir) { | 84 void SetProvideAutoAddDir(bool provide_auto_add_dir) { |
85 if (provide_auto_add_dir) { | 85 if (provide_auto_add_dir) { |
86 if (!fake_auto_add_dir_.IsValid()) | 86 if (!fake_auto_add_dir_.IsValid()) |
87 ASSERT_TRUE(fake_auto_add_dir_.CreateUniqueTempDir()); | 87 ASSERT_TRUE(fake_auto_add_dir_.CreateUniqueTempDir()); |
88 } else { | 88 } else { |
89 ASSERT_TRUE(fake_auto_add_dir_.Delete()); | 89 ASSERT_TRUE(fake_auto_add_dir_.Delete()); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 base::ScopedTempDir fake_auto_add_dir_; | 94 base::ScopedTempDir fake_auto_add_dir_; |
95 }; | 95 }; |
96 | 96 |
97 class TestITunesFileUtil : public ITunesFileUtil { | 97 class TestITunesFileUtil : public ITunesFileUtil { |
98 public: | 98 public: |
99 explicit TestITunesFileUtil(MediaPathFilter* media_path_filter, | 99 explicit TestITunesFileUtil(MediaPathFilter* media_path_filter, |
100 ITunesDataProvider* data_provider) | 100 ITunesDataProvider* data_provider) |
101 : ITunesFileUtil(media_path_filter), | 101 : ITunesFileUtil(media_path_filter), |
102 data_provider_(data_provider) { | 102 data_provider_(data_provider) { |
103 } | 103 } |
104 virtual ~TestITunesFileUtil() {} | 104 ~TestITunesFileUtil() override {} |
105 | 105 |
106 private: | 106 private: |
107 virtual ITunesDataProvider* GetDataProvider() override { | 107 ITunesDataProvider* GetDataProvider() override { return data_provider_; } |
108 return data_provider_; | |
109 } | |
110 | 108 |
111 ITunesDataProvider* data_provider_; | 109 ITunesDataProvider* data_provider_; |
112 }; | 110 }; |
113 | 111 |
114 class TestMediaFileSystemBackend : public MediaFileSystemBackend { | 112 class TestMediaFileSystemBackend : public MediaFileSystemBackend { |
115 public: | 113 public: |
116 TestMediaFileSystemBackend(const base::FilePath& profile_path, | 114 TestMediaFileSystemBackend(const base::FilePath& profile_path, |
117 ITunesFileUtil* itunes_file_util) | 115 ITunesFileUtil* itunes_file_util) |
118 : MediaFileSystemBackend( | 116 : MediaFileSystemBackend( |
119 profile_path, | 117 profile_path, |
120 MediaFileSystemBackend::MediaTaskRunner().get()), | 118 MediaFileSystemBackend::MediaTaskRunner().get()), |
121 test_file_util_(itunes_file_util) {} | 119 test_file_util_(itunes_file_util) {} |
122 | 120 |
123 virtual storage::AsyncFileUtil* GetAsyncFileUtil( | 121 storage::AsyncFileUtil* GetAsyncFileUtil( |
124 storage::FileSystemType type) override { | 122 storage::FileSystemType type) override { |
125 if (type != storage::kFileSystemTypeItunes) | 123 if (type != storage::kFileSystemTypeItunes) |
126 return NULL; | 124 return NULL; |
127 | 125 |
128 return test_file_util_.get(); | 126 return test_file_util_.get(); |
129 } | 127 } |
130 | 128 |
131 private: | 129 private: |
132 scoped_ptr<storage::AsyncFileUtil> test_file_util_; | 130 scoped_ptr<storage::AsyncFileUtil> test_file_util_; |
133 }; | 131 }; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 completed = false; | 341 completed = false; |
344 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); | 342 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); |
345 ASSERT_TRUE(completed); | 343 ASSERT_TRUE(completed); |
346 ASSERT_EQ(1u, contents.size()); | 344 ASSERT_EQ(1u, contents.size()); |
347 EXPECT_FALSE(contents.front().is_directory); | 345 EXPECT_FALSE(contents.front().is_directory); |
348 EXPECT_EQ(base::FilePath().AppendASCII("baz.ogg").value(), | 346 EXPECT_EQ(base::FilePath().AppendASCII("baz.ogg").value(), |
349 contents.front().name); | 347 contents.front().name); |
350 } | 348 } |
351 | 349 |
352 } // namespace itunes | 350 } // namespace itunes |
OLD | NEW |