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(UTF8ToWide(dir)); | 243 return base::FilePath(FILE_PATH_LITERAL("C:\\")).Append( |
| 244 base::UTF8ToWide(dir)); |
244 #elif defined(OS_POSIX) | 245 #elif defined(OS_POSIX) |
245 return base::FilePath(FILE_PATH_LITERAL("/")).Append(dir); | 246 return base::FilePath(FILE_PATH_LITERAL("/")).Append(dir); |
246 #else | 247 #else |
247 NOTREACHED(); | 248 NOTREACHED(); |
248 #endif | 249 #endif |
249 } | 250 } |
250 | 251 |
251 TEST_F(MediaGalleriesPreferencesTest, GalleryManagement) { | 252 TEST_F(MediaGalleriesPreferencesTest, GalleryManagement) { |
252 MediaGalleryPrefId auto_id, user_added_id, id; | 253 MediaGalleryPrefId auto_id, user_added_id, id; |
253 base::FilePath path; | 254 base::FilePath path; |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 // Remove a user added gallery and it should go away. | 738 // Remove a user added gallery and it should go away. |
738 gallery_prefs()->ForgetGalleryById(user_added_id); | 739 gallery_prefs()->ForgetGalleryById(user_added_id); |
739 expected_galleries_.erase(user_added_id); | 740 expected_galleries_.erase(user_added_id); |
740 expected_device_map[device_id].erase(user_added_id); | 741 expected_device_map[device_id].erase(user_added_id); |
741 | 742 |
742 EXPECT_EQ(2, observer1.notifications()); | 743 EXPECT_EQ(2, observer1.notifications()); |
743 EXPECT_EQ(3, observer2.notifications()); | 744 EXPECT_EQ(3, observer2.notifications()); |
744 } | 745 } |
745 | 746 |
746 } // namespace chrome | 747 } // namespace chrome |
OLD | NEW |