| 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 <stdint.h> |
| 6 |
| 5 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" |
| 9 #include "build/build_config.h" |
| 6 #include "chrome/common/media_galleries/itunes_library.h" | 10 #include "chrome/common/media_galleries/itunes_library.h" |
| 7 #include "chrome/utility/media_galleries/itunes_library_parser.h" | 11 #include "chrome/utility/media_galleries/itunes_library_parser.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 13 |
| 10 #define SIMPLE_HEADER() \ | 14 #define SIMPLE_HEADER() \ |
| 11 "<plist>" \ | 15 "<plist>" \ |
| 12 " <dict>" \ | 16 " <dict>" \ |
| 13 " <key>Tracks</key>" \ | 17 " <key>Tracks</key>" \ |
| 14 " <dict>" | 18 " <dict>" |
| 15 | 19 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 void TestParser(bool expected_result, const std::string& xml) { | 85 void TestParser(bool expected_result, const std::string& xml) { |
| 82 ITunesLibraryParser parser; | 86 ITunesLibraryParser parser; |
| 83 | 87 |
| 84 EXPECT_EQ(expected_result, parser.Parse(xml)); | 88 EXPECT_EQ(expected_result, parser.Parse(xml)); |
| 85 if (!expected_result) | 89 if (!expected_result) |
| 86 return; | 90 return; |
| 87 | 91 |
| 88 CompareLibrary(expected_library_, parser.library()); | 92 CompareLibrary(expected_library_, parser.library()); |
| 89 } | 93 } |
| 90 | 94 |
| 91 void AddExpectedTrack(uint32 id, const std::string& location, | 95 void AddExpectedTrack(uint32_t id, |
| 92 const std::string& artist, const std::string& album) { | 96 const std::string& location, |
| 97 const std::string& artist, |
| 98 const std::string& album) { |
| 93 // On Mac this pretends that C: is a directory. | 99 // On Mac this pretends that C: is a directory. |
| 94 #if defined(OS_MACOSX) | 100 #if defined(OS_MACOSX) |
| 95 std::string os_location = "/" + location; | 101 std::string os_location = "/" + location; |
| 96 #else | 102 #else |
| 97 const std::string& os_location = location; | 103 const std::string& os_location = location; |
| 98 #endif | 104 #endif |
| 99 parser::Track track(id, base::FilePath::FromUTF8Unsafe(os_location)); | 105 parser::Track track(id, base::FilePath::FromUTF8Unsafe(os_location)); |
| 100 expected_library_[artist][album].insert(track); | 106 expected_library_[artist][album].insert(track); |
| 101 } | 107 } |
| 102 | 108 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 SIMPLE_HEADER() | 283 SIMPLE_HEADER() |
| 278 // This path is concatenated with "http://localhost/", so no leading | 284 // This path is concatenated with "http://localhost/", so no leading |
| 279 // slash should be used. | 285 // slash should be used. |
| 280 SIMPLE_TRACK(1, 1, "dir/Song%20With%20Space.mp3", "Artist A", "Album A") | 286 SIMPLE_TRACK(1, 1, "dir/Song%20With%20Space.mp3", "Artist A", "Album A") |
| 281 SIMPLE_FOOTER()); | 287 SIMPLE_FOOTER()); |
| 282 } | 288 } |
| 283 | 289 |
| 284 } // namespace | 290 } // namespace |
| 285 | 291 |
| 286 } // namespace itunes | 292 } // namespace itunes |
| OLD | NEW |