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

Side by Side Diff: chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc

Issue 660343006: Standardize usage of virtual/override/final in chrome/browser/media_galleries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 } // namespace 67 } // namespace
68 68
69 class TestIPhotoDataProvider : public IPhotoDataProvider { 69 class TestIPhotoDataProvider : public IPhotoDataProvider {
70 public: 70 public:
71 explicit TestIPhotoDataProvider(const base::FilePath& fake_library_path) 71 explicit TestIPhotoDataProvider(const base::FilePath& fake_library_path)
72 : IPhotoDataProvider(fake_library_path) { 72 : IPhotoDataProvider(fake_library_path) {
73 EXPECT_TRUE(fake_auto_add_dir_.CreateUniqueTempDir()); 73 EXPECT_TRUE(fake_auto_add_dir_.CreateUniqueTempDir());
74 } 74 }
75 75
76 virtual ~TestIPhotoDataProvider() {} 76 ~TestIPhotoDataProvider() override {}
77 77
78 virtual void RefreshData(const ReadyCallback& ready_callback) override { 78 void RefreshData(const ReadyCallback& ready_callback) override {
79 ready_callback.Run(true /* success */); 79 ready_callback.Run(true /* success */);
80 } 80 }
81 81
82 virtual std::vector<std::string> GetAlbumNames() const override { 82 std::vector<std::string> GetAlbumNames() const override {
83 std::vector<std::string> names; 83 std::vector<std::string> names;
84 names.push_back("Album1"); 84 names.push_back("Album1");
85 names.push_back("has_originals"); 85 names.push_back("has_originals");
86 return names; 86 return names;
87 } 87 }
88 88
89 virtual std::map<std::string, base::FilePath> GetAlbumContents( 89 std::map<std::string, base::FilePath> GetAlbumContents(
90 const std::string& album) const override { 90 const std::string& album) const override {
91 std::map<std::string, base::FilePath> contents; 91 std::map<std::string, base::FilePath> contents;
92 contents["a.jpg"] = library_path().AppendASCII("a.jpg"); 92 contents["a.jpg"] = library_path().AppendASCII("a.jpg");
93 return contents; 93 return contents;
94 } 94 }
95 95
96 virtual base::FilePath GetPhotoLocationInAlbum( 96 base::FilePath GetPhotoLocationInAlbum(
97 const std::string& album, 97 const std::string& album,
98 const std::string& filename) const override { 98 const std::string& filename) const override {
99 return library_path().AppendASCII("a.jpg"); 99 return library_path().AppendASCII("a.jpg");
100 } 100 }
101 101
102 virtual bool HasOriginals(const std::string& album) const override { 102 bool HasOriginals(const std::string& album) const override {
103 return (album == "has_originals"); 103 return (album == "has_originals");
104 } 104 }
105 105
106 virtual std::map<std::string, base::FilePath> GetOriginals( 106 std::map<std::string, base::FilePath> GetOriginals(
107 const std::string& album) const override { 107 const std::string& album) const override {
108 std::map<std::string, base::FilePath> contents; 108 std::map<std::string, base::FilePath> contents;
109 contents["a.jpg"] = library_path().AppendASCII("orig.jpg"); 109 contents["a.jpg"] = library_path().AppendASCII("orig.jpg");
110 return contents; 110 return contents;
111 } 111 }
112 112
113 virtual base::FilePath GetOriginalPhotoLocation( 113 base::FilePath GetOriginalPhotoLocation(
114 const std::string& album, 114 const std::string& album,
115 const std::string& filename) const override { 115 const std::string& filename) const override {
116 return library_path().AppendASCII("orig.jpg"); 116 return library_path().AppendASCII("orig.jpg");
117 } 117 }
118 118
119 private: 119 private:
120 base::ScopedTempDir fake_auto_add_dir_; 120 base::ScopedTempDir fake_auto_add_dir_;
121 }; 121 };
122 122
123 class TestIPhotoFileUtil : public IPhotoFileUtil { 123 class TestIPhotoFileUtil : public IPhotoFileUtil {
124 public: 124 public:
125 explicit TestIPhotoFileUtil(MediaPathFilter* media_path_filter, 125 explicit TestIPhotoFileUtil(MediaPathFilter* media_path_filter,
126 IPhotoDataProvider* data_provider) 126 IPhotoDataProvider* data_provider)
127 : IPhotoFileUtil(media_path_filter), 127 : IPhotoFileUtil(media_path_filter),
128 data_provider_(data_provider) { 128 data_provider_(data_provider) {
129 } 129 }
130 virtual ~TestIPhotoFileUtil() {} 130 ~TestIPhotoFileUtil() override {}
131 131
132 private: 132 private:
133 virtual IPhotoDataProvider* GetDataProvider() override { 133 IPhotoDataProvider* GetDataProvider() override { return data_provider_; }
134 return data_provider_;
135 }
136 134
137 IPhotoDataProvider* data_provider_; 135 IPhotoDataProvider* data_provider_;
138 }; 136 };
139 137
140 class TestMediaFileSystemBackend : public MediaFileSystemBackend { 138 class TestMediaFileSystemBackend : public MediaFileSystemBackend {
141 public: 139 public:
142 TestMediaFileSystemBackend(const base::FilePath& profile_path, 140 TestMediaFileSystemBackend(const base::FilePath& profile_path,
143 IPhotoFileUtil* iphoto_file_util) 141 IPhotoFileUtil* iphoto_file_util)
144 : MediaFileSystemBackend( 142 : MediaFileSystemBackend(
145 profile_path, 143 profile_path,
146 MediaFileSystemBackend::MediaTaskRunner().get()), 144 MediaFileSystemBackend::MediaTaskRunner().get()),
147 test_file_util_(iphoto_file_util) {} 145 test_file_util_(iphoto_file_util) {}
148 146
149 virtual storage::AsyncFileUtil* GetAsyncFileUtil( 147 storage::AsyncFileUtil* GetAsyncFileUtil(
150 storage::FileSystemType type) override { 148 storage::FileSystemType type) override {
151 if (type != storage::kFileSystemTypeIphoto) 149 if (type != storage::kFileSystemTypeIphoto)
152 return NULL; 150 return NULL;
153 151
154 return test_file_util_.get(); 152 return test_file_util_.get();
155 } 153 }
156 154
157 private: 155 private:
158 scoped_ptr<storage::AsyncFileUtil> test_file_util_; 156 scoped_ptr<storage::AsyncFileUtil> test_file_util_;
159 }; 157 };
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 completed = false; 343 completed = false;
346 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); 344 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed);
347 ASSERT_TRUE(completed); 345 ASSERT_TRUE(completed);
348 ASSERT_EQ(1u, contents.size()); 346 ASSERT_EQ(1u, contents.size());
349 347
350 EXPECT_FALSE(contents.front().is_directory); 348 EXPECT_FALSE(contents.front().is_directory);
351 EXPECT_EQ("a.jpg", contents.front().name); 349 EXPECT_EQ("a.jpg", contents.front().name);
352 } 350 }
353 351
354 } // namespace iphoto 352 } // namespace iphoto
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698