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 <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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 "Artist", "Album2", | 391 "Artist", "Album2", |
392 "Track.mp3").NormalizePathSeparators().value()); | 392 "Track.mp3").NormalizePathSeparators().value()); |
393 | 393 |
394 TestDone(); | 394 TestDone(); |
395 } | 395 } |
396 | 396 |
397 private: | 397 private: |
398 DISALLOW_COPY_AND_ASSIGN(ITunesDataProviderUniqueNameTest); | 398 DISALLOW_COPY_AND_ASSIGN(ITunesDataProviderUniqueNameTest); |
399 }; | 399 }; |
400 | 400 |
| 401 class ITunesDataProviderEscapeTest : public ITunesDataProviderTest { |
| 402 // Albums and tracks that aren't the same, but become the same after |
| 403 // replacing bad characters are not handled properly, but that case should |
| 404 // never happen in practice. |
| 405 public: |
| 406 ITunesDataProviderEscapeTest() {} |
| 407 virtual ~ITunesDataProviderEscapeTest() {} |
| 408 |
| 409 virtual std::vector<LibraryEntry> SetUpLibrary() OVERRIDE { |
| 410 base::FilePath track = library_dir().AppendASCII("Track:1.mp3"); |
| 411 std::vector<LibraryEntry> entries; |
| 412 entries.push_back(LibraryEntry("Artist:/name", "Album:name/", track)); |
| 413 entries.push_back(LibraryEntry("Artist/name", "Album:name", track)); |
| 414 entries.push_back(LibraryEntry("Artist/name", "Album:name", track)); |
| 415 return entries; |
| 416 } |
| 417 |
| 418 virtual void StartTest(bool parse_success) OVERRIDE { |
| 419 EXPECT_TRUE(parse_success); |
| 420 |
| 421 base::FilePath track = |
| 422 library_dir().AppendASCII("Track:1.mp3").NormalizePathSeparators(); |
| 423 EXPECT_EQ(track.value(), |
| 424 data_provider()->GetTrackLocation( |
| 425 "Artist__name", "Album_name_", |
| 426 "Track_1.mp3").NormalizePathSeparators().value()); |
| 427 EXPECT_EQ(track.value(), |
| 428 data_provider()->GetTrackLocation( |
| 429 "Artist_name", "Album_name", |
| 430 "Track_1 (2).mp3").NormalizePathSeparators().value()); |
| 431 EXPECT_EQ(track.value(), |
| 432 data_provider()->GetTrackLocation( |
| 433 "Artist_name", "Album_name", |
| 434 "Track_1 (3).mp3").NormalizePathSeparators().value()); |
| 435 |
| 436 TestDone(); |
| 437 } |
| 438 |
| 439 private: |
| 440 DISALLOW_COPY_AND_ASSIGN(ITunesDataProviderEscapeTest); |
| 441 }; |
| 442 |
401 IN_PROC_BROWSER_TEST_F(ITunesDataProviderBasicTest, BasicTest) { | 443 IN_PROC_BROWSER_TEST_F(ITunesDataProviderBasicTest, BasicTest) { |
402 RunTest(); | 444 RunTest(); |
403 } | 445 } |
404 | 446 |
405 IN_PROC_BROWSER_TEST_F(ITunesDataProviderRefreshTest, RefreshTest) { | 447 IN_PROC_BROWSER_TEST_F(ITunesDataProviderRefreshTest, RefreshTest) { |
406 RunTest(); | 448 RunTest(); |
407 } | 449 } |
408 | 450 |
409 IN_PROC_BROWSER_TEST_F(ITunesDataProviderInvalidTest, InvalidTest) { | 451 IN_PROC_BROWSER_TEST_F(ITunesDataProviderInvalidTest, InvalidTest) { |
410 RunTest(); | 452 RunTest(); |
411 } | 453 } |
412 | 454 |
413 IN_PROC_BROWSER_TEST_F(ITunesDataProviderUniqueNameTest, UniqueNameTest) { | 455 IN_PROC_BROWSER_TEST_F(ITunesDataProviderUniqueNameTest, UniqueNameTest) { |
414 RunTest(); | 456 RunTest(); |
415 } | 457 } |
416 | 458 |
| 459 IN_PROC_BROWSER_TEST_F(ITunesDataProviderEscapeTest, EscapeTest) { |
| 460 RunTest(); |
| 461 } |
| 462 |
417 } // namespace itunes | 463 } // namespace itunes |
OLD | NEW |