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 // MediaGalleriesPreferences unit tests. | 5 // MediaGalleriesPreferences unit tests. |
6 | 6 |
7 #include "chrome/browser/media_gallery/media_galleries_preferences.h" | 7 #include "chrome/browser/media_gallery/media_galleries_preferences.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 scoped_ptr<TestingProfile> profile_; | 233 scoped_ptr<TestingProfile> profile_; |
234 scoped_ptr<MediaGalleriesPreferences> gallery_prefs_; | 234 scoped_ptr<MediaGalleriesPreferences> gallery_prefs_; |
235 | 235 |
236 uint64 default_galleries_count_; | 236 uint64 default_galleries_count_; |
237 | 237 |
238 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferencesTest); | 238 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferencesTest); |
239 }; | 239 }; |
240 | 240 |
241 base::FilePath MakePath(std::string dir) { | 241 base::FilePath MakePath(std::string dir) { |
242 #if defined(OS_WIN) | 242 #if defined(OS_WIN) |
243 return base::FilePath(FILE_PATH_LITERAL("C:\\")).Append( | 243 return base::FilePath(FILE_PATH_LITERAL("C:\\")).Append(UTF8ToWide(dir)); |
244 base::UTF8ToWide(dir)); | |
245 #elif defined(OS_POSIX) | 244 #elif defined(OS_POSIX) |
246 return base::FilePath(FILE_PATH_LITERAL("/")).Append(dir); | 245 return base::FilePath(FILE_PATH_LITERAL("/")).Append(dir); |
247 #else | 246 #else |
248 NOTREACHED(); | 247 NOTREACHED(); |
249 #endif | 248 #endif |
250 } | 249 } |
251 | 250 |
252 TEST_F(MediaGalleriesPreferencesTest, GalleryManagement) { | 251 TEST_F(MediaGalleriesPreferencesTest, GalleryManagement) { |
253 MediaGalleryPrefId auto_id, user_added_id, id; | 252 MediaGalleryPrefId auto_id, user_added_id, id; |
254 base::FilePath path; | 253 base::FilePath path; |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 // Remove a user added gallery and it should go away. | 737 // Remove a user added gallery and it should go away. |
739 gallery_prefs()->ForgetGalleryById(user_added_id); | 738 gallery_prefs()->ForgetGalleryById(user_added_id); |
740 expected_galleries_.erase(user_added_id); | 739 expected_galleries_.erase(user_added_id); |
741 expected_device_map[device_id].erase(user_added_id); | 740 expected_device_map[device_id].erase(user_added_id); |
742 | 741 |
743 EXPECT_EQ(2, observer1.notifications()); | 742 EXPECT_EQ(2, observer1.notifications()); |
744 EXPECT_EQ(3, observer2.notifications()); | 743 EXPECT_EQ(3, observer2.notifications()); |
745 } | 744 } |
746 | 745 |
747 } // namespace chrome | 746 } // namespace chrome |
OLD | NEW |