OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 "</dict>\n" | 358 "</dict>\n" |
359 "</plist>"; | 359 "</plist>"; |
360 | 360 |
361 base::FilePath test_jpg_path = GetCommonDataDir().AppendASCII("test.jpg"); | 361 base::FilePath test_jpg_path = GetCommonDataDir().AppendASCII("test.jpg"); |
362 ASSERT_TRUE(base::CreateDirectory(iphoto_data_root)); | 362 ASSERT_TRUE(base::CreateDirectory(iphoto_data_root)); |
363 base::FilePath first_only_jpg = | 363 base::FilePath first_only_jpg = |
364 iphoto_data_root.AppendASCII("InFirstAlbumOnly.jpg"); | 364 iphoto_data_root.AppendASCII("InFirstAlbumOnly.jpg"); |
365 base::FilePath in_both_jpg = iphoto_data_root.AppendASCII("InBoth.jpg"); | 365 base::FilePath in_both_jpg = iphoto_data_root.AppendASCII("InBoth.jpg"); |
366 ASSERT_TRUE(base::CopyFile(test_jpg_path, first_only_jpg)); | 366 ASSERT_TRUE(base::CopyFile(test_jpg_path, first_only_jpg)); |
367 ASSERT_TRUE(base::CopyFile(test_jpg_path, in_both_jpg)); | 367 ASSERT_TRUE(base::CopyFile(test_jpg_path, in_both_jpg)); |
368 ReplaceFirstSubstringAfterOffset( | 368 base::ReplaceFirstSubstringAfterOffset( |
369 &xml_contents, 0, std::string("$path1"), first_only_jpg.value()); | 369 &xml_contents, 0, "$path1", first_only_jpg.value()); |
370 ReplaceFirstSubstringAfterOffset( | 370 base::ReplaceFirstSubstringAfterOffset( |
371 &xml_contents, 0, std::string("$path2"), in_both_jpg.value()); | 371 &xml_contents, 0, "$path2", in_both_jpg.value()); |
372 | 372 |
373 base::FilePath album_xml = iphoto_data_root.AppendASCII("AlbumData.xml"); | 373 base::FilePath album_xml = iphoto_data_root.AppendASCII("AlbumData.xml"); |
374 ASSERT_NE(-1, base::WriteFile(album_xml, | 374 ASSERT_NE(-1, base::WriteFile(album_xml, |
375 xml_contents.c_str(), xml_contents.size())); | 375 xml_contents.c_str(), xml_contents.size())); |
376 } | 376 } |
377 #endif // defined(OS_MACOSX) | 377 #endif // defined(OS_MACOSX) |
378 | 378 |
379 base::FilePath GetCommonDataDir() const { | 379 base::FilePath GetCommonDataDir() const { |
380 return test_data_dir_.AppendASCII("api_test") | 380 return test_data_dir_.AppendASCII("api_test") |
381 .AppendASCII("media_galleries") | 381 .AppendASCII("media_galleries") |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 | 671 |
672 base::ListValue custom_args; | 672 base::ListValue custom_args; |
673 #if defined(USE_PROPRIETARY_CODECS) | 673 #if defined(USE_PROPRIETARY_CODECS) |
674 custom_args.AppendBoolean(true); | 674 custom_args.AppendBoolean(true); |
675 #else | 675 #else |
676 custom_args.AppendBoolean(false); | 676 custom_args.AppendBoolean(false); |
677 #endif | 677 #endif |
678 ASSERT_TRUE(RunMediaGalleriesTestWithArg("media_metadata", custom_args)) | 678 ASSERT_TRUE(RunMediaGalleriesTestWithArg("media_metadata", custom_args)) |
679 << message_; | 679 << message_; |
680 } | 680 } |
OLD | NEW |