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 "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/base_paths_win.h" | 6 #include "base/base_paths_win.h" |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return app_data_dir_.path(); | 54 return app_data_dir_.path(); |
55 } | 55 } |
56 | 56 |
57 const base::FilePath& music_dir() { | 57 const base::FilePath& music_dir() { |
58 return music_dir_.path(); | 58 return music_dir_.path(); |
59 } | 59 } |
60 | 60 |
61 void WritePrefFile(const std::string& data) { | 61 void WritePrefFile(const std::string& data) { |
62 base::FilePath pref_dir = | 62 base::FilePath pref_dir = |
63 app_data_dir().AppendASCII("Apple Computer").AppendASCII("iTunes"); | 63 app_data_dir().AppendASCII("Apple Computer").AppendASCII("iTunes"); |
64 ASSERT_TRUE(file_util::CreateDirectory(pref_dir)); | 64 ASSERT_TRUE(base::CreateDirectory(pref_dir)); |
65 ASSERT_EQ(data.size(), | 65 ASSERT_EQ(data.size(), |
66 file_util::WriteFile(pref_dir.AppendASCII("iTunesPrefs.xml"), | 66 file_util::WriteFile(pref_dir.AppendASCII("iTunesPrefs.xml"), |
67 data.data(), data.size())); | 67 data.data(), data.size())); |
68 } | 68 } |
69 | 69 |
70 void TouchDefault() { | 70 void TouchDefault() { |
71 base::FilePath default_dir = music_dir().AppendASCII("iTunes"); | 71 base::FilePath default_dir = music_dir().AppendASCII("iTunes"); |
72 ASSERT_TRUE(file_util::CreateDirectory(default_dir)); | 72 ASSERT_TRUE(base::CreateDirectory(default_dir)); |
73 TouchFile(default_dir.AppendASCII("iTunes Music Library.xml")); | 73 TouchFile(default_dir.AppendASCII("iTunes Music Library.xml")); |
74 } | 74 } |
75 | 75 |
76 void TestFindITunesLibrary() { | 76 void TestFindITunesLibrary() { |
77 test_finder_callback_called_ = false; | 77 test_finder_callback_called_ = false; |
78 result_.clear(); | 78 result_.clear(); |
79 base::RunLoop loop; | 79 base::RunLoop loop; |
80 FindITunesLibrary(base::Bind(&ITunesFinderWinTest::TestFinderCallback, | 80 FindITunesLibrary(base::Bind(&ITunesFinderWinTest::TestFinderCallback, |
81 base::Unretained(this), loop.QuitClosure())); | 81 base::Unretained(this), loop.QuitClosure())); |
82 loop.Run(); | 82 loop.Run(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 "</plist>", EncodePath(library_xml).c_str()); | 186 "</plist>", EncodePath(library_xml).c_str()); |
187 WritePrefFile(xml); | 187 WritePrefFile(xml); |
188 TestFindITunesLibrary(); | 188 TestFindITunesLibrary(); |
189 EXPECT_TRUE(test_finder_callback_called()); | 189 EXPECT_TRUE(test_finder_callback_called()); |
190 EXPECT_TRUE(EmptyResult()); | 190 EXPECT_TRUE(EmptyResult()); |
191 } | 191 } |
192 | 192 |
193 } // namespace | 193 } // namespace |
194 | 194 |
195 } // namespace iapps | 195 } // namespace iapps |
OLD | NEW |