| 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 "chrome/browser/media_galleries/fileapi/iapps_finder_impl.h" | 5 #include "chrome/browser/media_galleries/fileapi/iapps_finder_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/base_paths_win.h" | 10 #include "base/base_paths_win.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void SetUp() override { | 45 void SetUp() override { |
| 46 ASSERT_TRUE(app_data_dir_.CreateUniqueTempDir()); | 46 ASSERT_TRUE(app_data_dir_.CreateUniqueTempDir()); |
| 47 ASSERT_TRUE(music_dir_.CreateUniqueTempDir()); | 47 ASSERT_TRUE(music_dir_.CreateUniqueTempDir()); |
| 48 app_data_dir_override_.reset( | 48 app_data_dir_override_.reset( |
| 49 new base::ScopedPathOverride(base::DIR_APP_DATA, app_data_dir())); | 49 new base::ScopedPathOverride(base::DIR_APP_DATA, app_data_dir())); |
| 50 music_dir_override_.reset( | 50 music_dir_override_.reset( |
| 51 new base::ScopedPathOverride(chrome::DIR_USER_MUSIC, music_dir())); | 51 new base::ScopedPathOverride(chrome::DIR_USER_MUSIC, music_dir())); |
| 52 InProcessBrowserTest::SetUp(); | 52 InProcessBrowserTest::SetUp(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 const base::FilePath& app_data_dir() { | 55 const base::FilePath& app_data_dir() { return app_data_dir_.GetPath(); } |
| 56 return app_data_dir_.path(); | |
| 57 } | |
| 58 | 56 |
| 59 const base::FilePath& music_dir() { | 57 const base::FilePath& music_dir() { return music_dir_.GetPath(); } |
| 60 return music_dir_.path(); | |
| 61 } | |
| 62 | 58 |
| 63 void WritePrefFile(const std::string& data) { | 59 void WritePrefFile(const std::string& data) { |
| 64 base::FilePath pref_dir = | 60 base::FilePath pref_dir = |
| 65 app_data_dir().AppendASCII("Apple Computer").AppendASCII("iTunes"); | 61 app_data_dir().AppendASCII("Apple Computer").AppendASCII("iTunes"); |
| 66 ASSERT_TRUE(base::CreateDirectory(pref_dir)); | 62 ASSERT_TRUE(base::CreateDirectory(pref_dir)); |
| 67 ASSERT_EQ(static_cast<int>(data.size()), | 63 ASSERT_EQ(static_cast<int>(data.size()), |
| 68 base::WriteFile(pref_dir.AppendASCII("iTunesPrefs.xml"), | 64 base::WriteFile(pref_dir.AppendASCII("iTunesPrefs.xml"), |
| 69 data.data(), data.size())); | 65 data.data(), data.size())); |
| 70 } | 66 } |
| 71 | 67 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 "</plist>", EncodePath(library_xml).c_str()); | 184 "</plist>", EncodePath(library_xml).c_str()); |
| 189 WritePrefFile(xml); | 185 WritePrefFile(xml); |
| 190 TestFindITunesLibrary(); | 186 TestFindITunesLibrary(); |
| 191 EXPECT_TRUE(test_finder_callback_called()); | 187 EXPECT_TRUE(test_finder_callback_called()); |
| 192 EXPECT_TRUE(EmptyResult()); | 188 EXPECT_TRUE(EmptyResult()); |
| 193 } | 189 } |
| 194 | 190 |
| 195 } // namespace | 191 } // namespace |
| 196 | 192 |
| 197 } // namespace iapps | 193 } // namespace iapps |
| OLD | NEW |