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_galleries/media_galleries_preferences.h" | 7 #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 using storage_monitor::TestStorageMonitor; | 48 using storage_monitor::TestStorageMonitor; |
49 | 49 |
50 namespace { | 50 namespace { |
51 | 51 |
52 class MockGalleryChangeObserver | 52 class MockGalleryChangeObserver |
53 : public MediaGalleriesPreferences::GalleryChangeObserver { | 53 : public MediaGalleriesPreferences::GalleryChangeObserver { |
54 public: | 54 public: |
55 explicit MockGalleryChangeObserver(MediaGalleriesPreferences* pref) | 55 explicit MockGalleryChangeObserver(MediaGalleriesPreferences* pref) |
56 : pref_(pref), | 56 : pref_(pref), |
57 notifications_(0) {} | 57 notifications_(0) {} |
58 virtual ~MockGalleryChangeObserver() {} | 58 ~MockGalleryChangeObserver() override {} |
59 | 59 |
60 int notifications() const { return notifications_;} | 60 int notifications() const { return notifications_;} |
61 | 61 |
62 private: | 62 private: |
63 // MediaGalleriesPreferences::GalleryChangeObserver implementation. | 63 // MediaGalleriesPreferences::GalleryChangeObserver implementation. |
64 virtual void OnPermissionAdded(MediaGalleriesPreferences* pref, | 64 void OnPermissionAdded(MediaGalleriesPreferences* pref, |
65 const std::string& extension_id, | 65 const std::string& extension_id, |
66 MediaGalleryPrefId pref_id) override { | 66 MediaGalleryPrefId pref_id) override { |
67 EXPECT_EQ(pref_, pref); | 67 EXPECT_EQ(pref_, pref); |
68 ++notifications_; | 68 ++notifications_; |
69 } | 69 } |
70 | 70 |
71 virtual void OnPermissionRemoved(MediaGalleriesPreferences* pref, | 71 void OnPermissionRemoved(MediaGalleriesPreferences* pref, |
72 const std::string& extension_id, | 72 const std::string& extension_id, |
73 MediaGalleryPrefId pref_id) override { | 73 MediaGalleryPrefId pref_id) override { |
74 EXPECT_EQ(pref_, pref); | 74 EXPECT_EQ(pref_, pref); |
75 ++notifications_; | 75 ++notifications_; |
76 } | 76 } |
77 | 77 |
78 virtual void OnGalleryAdded(MediaGalleriesPreferences* pref, | 78 void OnGalleryAdded(MediaGalleriesPreferences* pref, |
79 MediaGalleryPrefId pref_id) override { | 79 MediaGalleryPrefId pref_id) override { |
80 EXPECT_EQ(pref_, pref); | 80 EXPECT_EQ(pref_, pref); |
81 ++notifications_; | 81 ++notifications_; |
82 } | 82 } |
83 | 83 |
84 virtual void OnGalleryRemoved(MediaGalleriesPreferences* pref, | 84 void OnGalleryRemoved(MediaGalleriesPreferences* pref, |
85 MediaGalleryPrefId pref_id) override { | 85 MediaGalleryPrefId pref_id) override { |
86 EXPECT_EQ(pref_, pref); | 86 EXPECT_EQ(pref_, pref); |
87 ++notifications_; | 87 ++notifications_; |
88 } | 88 } |
89 | 89 |
90 virtual void OnGalleryInfoUpdated(MediaGalleriesPreferences* pref, | 90 void OnGalleryInfoUpdated(MediaGalleriesPreferences* pref, |
91 MediaGalleryPrefId pref_id) override { | 91 MediaGalleryPrefId pref_id) override { |
92 EXPECT_EQ(pref_, pref); | 92 EXPECT_EQ(pref_, pref); |
93 ++notifications_; | 93 ++notifications_; |
94 } | 94 } |
95 | 95 |
96 MediaGalleriesPreferences* pref_; | 96 MediaGalleriesPreferences* pref_; |
97 int notifications_; | 97 int notifications_; |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(MockGalleryChangeObserver); | 99 DISALLOW_COPY_AND_ASSIGN(MockGalleryChangeObserver); |
100 }; | 100 }; |
101 | 101 |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 MediaGalleryPrefInfo::DefaultGalleryType::kNotDefault) { | 1526 MediaGalleryPrefInfo::DefaultGalleryType::kNotDefault) { |
1527 found_user_added = true; | 1527 found_user_added = true; |
1528 } | 1528 } |
1529 } | 1529 } |
1530 | 1530 |
1531 EXPECT_TRUE(found_music); | 1531 EXPECT_TRUE(found_music); |
1532 EXPECT_TRUE(found_pictures); | 1532 EXPECT_TRUE(found_pictures); |
1533 EXPECT_TRUE(found_videos); | 1533 EXPECT_TRUE(found_videos); |
1534 EXPECT_TRUE(found_user_added); | 1534 EXPECT_TRUE(found_user_added); |
1535 } | 1535 } |
OLD | NEW |