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

Side by Side Diff: chrome/browser/media_galleries/fileapi/iphoto_data_provider_browsertest.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, 2 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 16 matching lines...) Expand all
27 27
28 namespace iphoto { 28 namespace iphoto {
29 29
30 class TestIPhotoDataProvider : public IPhotoDataProvider { 30 class TestIPhotoDataProvider : public IPhotoDataProvider {
31 public: 31 public:
32 TestIPhotoDataProvider(const base::FilePath& xml_library_path, 32 TestIPhotoDataProvider(const base::FilePath& xml_library_path,
33 const base::Closure& callback) 33 const base::Closure& callback)
34 : IPhotoDataProvider(xml_library_path), 34 : IPhotoDataProvider(xml_library_path),
35 callback_(callback) { 35 callback_(callback) {
36 } 36 }
37 virtual ~TestIPhotoDataProvider() {} 37 ~TestIPhotoDataProvider() override {}
38 38
39 private: 39 private:
40 virtual void OnLibraryChanged(const base::FilePath& path, 40 void OnLibraryChanged(const base::FilePath& path, bool error) override {
41 bool error) override {
42 IPhotoDataProvider::OnLibraryChanged(path, error); 41 IPhotoDataProvider::OnLibraryChanged(path, error);
43 callback_.Run(); 42 callback_.Run();
44 } 43 }
45 44
46 base::Closure callback_; 45 base::Closure callback_;
47 46
48 DISALLOW_COPY_AND_ASSIGN(TestIPhotoDataProvider); 47 DISALLOW_COPY_AND_ASSIGN(TestIPhotoDataProvider);
49 }; 48 };
50 49
51 class IPhotoDataProviderTest : public InProcessBrowserTest { 50 class IPhotoDataProviderTest : public InProcessBrowserTest {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 base::Closure quit_closure_; 150 base::Closure quit_closure_;
152 151
153 DISALLOW_COPY_AND_ASSIGN(IPhotoDataProviderTest); 152 DISALLOW_COPY_AND_ASSIGN(IPhotoDataProviderTest);
154 }; 153 };
155 154
156 class IPhotoDataProviderBasicTest : public IPhotoDataProviderTest { 155 class IPhotoDataProviderBasicTest : public IPhotoDataProviderTest {
157 public: 156 public:
158 IPhotoDataProviderBasicTest() {} 157 IPhotoDataProviderBasicTest() {}
159 virtual ~IPhotoDataProviderBasicTest() {} 158 virtual ~IPhotoDataProviderBasicTest() {}
160 159
161 virtual std::string GetLibraryString() override { 160 std::string GetLibraryString() override {
162 return "<plist><dict>\n" 161 return "<plist><dict>\n"
163 "<key>List of Albums</key>\n" 162 "<key>List of Albums</key>\n"
164 "<array>" 163 "<array>"
165 " <dict>\n" 164 " <dict>\n"
166 " <key>AlbumId</key>" 165 " <key>AlbumId</key>"
167 " <integer>14</integer>" 166 " <integer>14</integer>"
168 " <key>AlbumName</key>" 167 " <key>AlbumName</key>"
169 " <string>Album1</string>" 168 " <string>Album1</string>"
170 " <key>KeyList</key>" 169 " <key>KeyList</key>"
171 " <array>" 170 " <array>"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 " <string>/vol/dupe/path2.jpg</string>" 260 " <string>/vol/dupe/path2.jpg</string>"
262 " <key>ThumbPath</key>" 261 " <key>ThumbPath</key>"
263 " <string>/vol/dupe/thumb2.jpg</string>" 262 " <string>/vol/dupe/thumb2.jpg</string>"
264 " <key>OriginalPath</key>" \ 263 " <key>OriginalPath</key>" \
265 " <string>/original/vol/another2.jpg</string>" \ 264 " <string>/original/vol/another2.jpg</string>" \
266 " </dict>\n" 265 " </dict>\n"
267 "</dict>\n" 266 "</dict>\n"
268 "</dict></plist>\n"; 267 "</dict></plist>\n";
269 } 268 }
270 269
271 virtual void StartTest(bool parse_success) override { 270 void StartTest(bool parse_success) override {
272 EXPECT_TRUE(parse_success); 271 EXPECT_TRUE(parse_success);
273 272
274 std::vector<std::string> names = data_provider()->GetAlbumNames(); 273 std::vector<std::string> names = data_provider()->GetAlbumNames();
275 EXPECT_EQ(3U, names.size()); 274 EXPECT_EQ(3U, names.size());
276 EXPECT_EQ("Album1", names[0]); 275 EXPECT_EQ("Album1", names[0]);
277 276
278 EXPECT_EQ(FilePath("/vol/path1.jpg").value(), 277 EXPECT_EQ(FilePath("/vol/path1.jpg").value(),
279 data_provider()->GetPhotoLocationInAlbum( 278 data_provider()->GetPhotoLocationInAlbum(
280 "Album1", "path1.jpg").value()); 279 "Album1", "path1.jpg").value());
281 EXPECT_EQ(FilePath("/vol/path3.jpg").value(), 280 EXPECT_EQ(FilePath("/vol/path3.jpg").value(),
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 DISALLOW_COPY_AND_ASSIGN(IPhotoDataProviderBasicTest); 338 DISALLOW_COPY_AND_ASSIGN(IPhotoDataProviderBasicTest);
340 }; 339 };
341 340
342 class IPhotoDataProviderRefreshTest : public IPhotoDataProviderTest { 341 class IPhotoDataProviderRefreshTest : public IPhotoDataProviderTest {
343 public: 342 public:
344 IPhotoDataProviderRefreshTest() {} 343 IPhotoDataProviderRefreshTest() {}
345 virtual ~IPhotoDataProviderRefreshTest() {} 344 virtual ~IPhotoDataProviderRefreshTest() {}
346 345
347 std::string another_album; 346 std::string another_album;
348 347
349 virtual std::string GetLibraryString() override { 348 std::string GetLibraryString() override {
350 return "<plist><dict>\n" 349 return "<plist><dict>\n"
351 "<key>List of Albums</key>\n" 350 "<key>List of Albums</key>\n"
352 "<array>" 351 "<array>"
353 " <dict>" 352 " <dict>"
354 " <key>AlbumId</key>" 353 " <key>AlbumId</key>"
355 " <integer>14</integer>" 354 " <integer>14</integer>"
356 " <key>AlbumName</key>" 355 " <key>AlbumName</key>"
357 " <string>Album1</string>" 356 " <string>Album1</string>"
358 " <key>KeyList</key>" 357 " <key>KeyList</key>"
359 " <array>" 358 " <array>"
(...skipping 14 matching lines...) Expand all
374 " <string>guid1</string>" 373 " <string>guid1</string>"
375 " <key>ImagePath</key>" 374 " <key>ImagePath</key>"
376 " <string>/vol/path1.jpg</string>" 375 " <string>/vol/path1.jpg</string>"
377 " <key>ThumbPath</key>" 376 " <key>ThumbPath</key>"
378 " <string>/vol/thumb1.jpg</string>" 377 " <string>/vol/thumb1.jpg</string>"
379 " </dict>\n" 378 " </dict>\n"
380 "</dict>\n" 379 "</dict>\n"
381 "</dict></plist>\n"; 380 "</dict></plist>\n";
382 } 381 }
383 382
384 virtual void StartTest(bool parse_success) override { 383 void StartTest(bool parse_success) override {
385 EXPECT_TRUE(parse_success); 384 EXPECT_TRUE(parse_success);
386 385
387 EXPECT_EQ(FilePath("/vol/path1.jpg"), 386 EXPECT_EQ(FilePath("/vol/path1.jpg"),
388 data_provider()->GetPhotoLocationInAlbum("Album1", "path1.jpg")); 387 data_provider()->GetPhotoLocationInAlbum("Album1", "path1.jpg"));
389 std::vector<std::string> names = data_provider()->GetAlbumNames(); 388 std::vector<std::string> names = data_provider()->GetAlbumNames();
390 EXPECT_EQ(1U, names.size()); 389 EXPECT_EQ(1U, names.size());
391 EXPECT_EQ("Album1", names[0]); 390 EXPECT_EQ("Album1", names[0]);
392 391
393 another_album = 392 another_album =
394 " <dict>" 393 " <dict>"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 435
437 private: 436 private:
438 DISALLOW_COPY_AND_ASSIGN(IPhotoDataProviderRefreshTest); 437 DISALLOW_COPY_AND_ASSIGN(IPhotoDataProviderRefreshTest);
439 }; 438 };
440 439
441 class IPhotoDataProviderInvalidTest : public IPhotoDataProviderTest { 440 class IPhotoDataProviderInvalidTest : public IPhotoDataProviderTest {
442 public: 441 public:
443 IPhotoDataProviderInvalidTest() {} 442 IPhotoDataProviderInvalidTest() {}
444 virtual ~IPhotoDataProviderInvalidTest() {} 443 virtual ~IPhotoDataProviderInvalidTest() {}
445 444
446 virtual void StartTest(bool parse_success) override { 445 void StartTest(bool parse_success) override {
447 EXPECT_TRUE(parse_success); 446 EXPECT_TRUE(parse_success);
448 447
449 SetLibraryChangeCallback( 448 SetLibraryChangeCallback(
450 base::Bind(&IPhotoDataProvider::RefreshData, 449 base::Bind(&IPhotoDataProvider::RefreshData,
451 base::Unretained(data_provider()), 450 base::Unretained(data_provider()),
452 base::Bind(&IPhotoDataProviderInvalidTest::CheckInvalid, 451 base::Bind(&IPhotoDataProviderInvalidTest::CheckInvalid,
453 base::Unretained(this)))); 452 base::Unretained(this))));
454 EXPECT_EQ(1L, base::WriteFile(XmlFile(), " ", 1)); 453 EXPECT_EQ(1L, base::WriteFile(XmlFile(), " ", 1));
455 } 454 }
456 455
(...skipping 12 matching lines...) Expand all
469 468
470 IN_PROC_BROWSER_TEST_F(IPhotoDataProviderRefreshTest, RefreshTest) { 469 IN_PROC_BROWSER_TEST_F(IPhotoDataProviderRefreshTest, RefreshTest) {
471 RunTest(); 470 RunTest();
472 } 471 }
473 472
474 IN_PROC_BROWSER_TEST_F(IPhotoDataProviderInvalidTest, InvalidTest) { 473 IN_PROC_BROWSER_TEST_F(IPhotoDataProviderInvalidTest, InvalidTest) {
475 RunTest(); 474 RunTest();
476 } 475 }
477 476
478 } // namespace iphoto 477 } // namespace iphoto
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698