| 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" |
| 6 #include "chrome/common/media_galleries/iphoto_library.h" | 9 #include "chrome/common/media_galleries/iphoto_library.h" |
| 7 #include "chrome/utility/media_galleries/iphoto_library_parser.h" | 10 #include "chrome/utility/media_galleries/iphoto_library_parser.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 12 |
| 10 #define SIMPLE_HEADER() \ | 13 #define SIMPLE_HEADER() \ |
| 11 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \ | 14 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \ |
| 12 "<plist version=\"1.0\">" \ | 15 "<plist version=\"1.0\">" \ |
| 13 " <dict>" \ | 16 " <dict>" \ |
| 14 " <key>Archive Path</key>" \ | 17 " <key>Archive Path</key>" \ |
| 15 " <string>/Users/username/px</string>" | 18 " <string>/Users/username/px</string>" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void TestParser(bool expected_result, const std::string& xml) { | 157 void TestParser(bool expected_result, const std::string& xml) { |
| 155 IPhotoLibraryParser parser; | 158 IPhotoLibraryParser parser; |
| 156 | 159 |
| 157 EXPECT_EQ(expected_result, parser.Parse(xml)); | 160 EXPECT_EQ(expected_result, parser.Parse(xml)); |
| 158 if (!expected_result) | 161 if (!expected_result) |
| 159 return; | 162 return; |
| 160 | 163 |
| 161 CompareLibrary(expected_library_, parser.library()); | 164 CompareLibrary(expected_library_, parser.library()); |
| 162 } | 165 } |
| 163 | 166 |
| 164 void AddExpectedPhoto(uint32 id, | 167 void AddExpectedPhoto(uint32_t id, |
| 165 const std::string& location, | 168 const std::string& location, |
| 166 const std::string& album) { | 169 const std::string& album) { |
| 167 parser::Photo photo(id, base::FilePath::FromUTF8Unsafe(location), | 170 parser::Photo photo(id, base::FilePath::FromUTF8Unsafe(location), |
| 168 base::FilePath::FromUTF8Unsafe("/original" + location)); | 171 base::FilePath::FromUTF8Unsafe("/original" + location)); |
| 169 if (!album.empty()) | 172 if (!album.empty()) |
| 170 expected_library_.albums[album].insert(id); | 173 expected_library_.albums[album].insert(id); |
| 171 expected_library_.all_photos.insert(photo); | 174 expected_library_.all_photos.insert(photo); |
| 172 } | 175 } |
| 173 | 176 |
| 174 private: | 177 private: |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 SIMPLE_PHOTO(2, 2, "/dir/PhotoA2.jpg", "Photo 2") | 318 SIMPLE_PHOTO(2, 2, "/dir/PhotoA2.jpg", "Photo 2") |
| 316 SIMPLE_PHOTO(3, 3, "/dir/PhotoA3.jpg", "Photo 3") | 319 SIMPLE_PHOTO(3, 3, "/dir/PhotoA3.jpg", "Photo 3") |
| 317 SIMPLE_PHOTO(4, 4, "/dir/PhotoB1.jpg", "Photo 4") | 320 SIMPLE_PHOTO(4, 4, "/dir/PhotoB1.jpg", "Photo 4") |
| 318 IMAGE_LIST_FOOTER() | 321 IMAGE_LIST_FOOTER() |
| 319 SIMPLE_FOOTER()); | 322 SIMPLE_FOOTER()); |
| 320 } | 323 } |
| 321 | 324 |
| 322 } // namespace | 325 } // namespace |
| 323 | 326 |
| 324 } // namespace iphoto | 327 } // namespace iphoto |
| OLD | NEW |