Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm

Issue 1312053006: Remove CONTENT_SETTINGS_NUM_TYPES (part 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@website-settings-registry-4
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h " 5 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h "
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/mac/scoped_nsautorelease_pool.h" 9 #include "base/mac/scoped_nsautorelease_pool.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 anchoredAt:NSMakePoint(50, 20)]; 95 anchoredAt:NSMakePoint(50, 20)];
96 96
97 EXPECT_TRUE(controller); 97 EXPECT_TRUE(controller);
98 EXPECT_TRUE([[controller window] isVisible]); 98 EXPECT_TRUE([[controller window] isVisible]);
99 99
100 return controller; 100 return controller;
101 } 101 }
102 102
103 // Check that the bubble doesn't crash or leak for any settings type 103 // Check that the bubble doesn't crash or leak for any settings type
104 TEST_F(ContentSettingBubbleControllerTest, Init) { 104 TEST_F(ContentSettingBubbleControllerTest, Init) {
105 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 105 for (ContentSettingsType type :
106 if (i == CONTENT_SETTINGS_TYPE_NOTIFICATIONS || 106 ContentSettingBubbleModel::GetSupportedBubbleTypes()) {
107 i == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE || 107 // Media stream is tested in the MediaStreamBubble test below.
108 i == CONTENT_SETTINGS_TYPE_FULLSCREEN || 108 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM)
109 i == CONTENT_SETTINGS_TYPE_MOUSELOCK ||
110 i == CONTENT_SETTINGS_TYPE_MEDIASTREAM ||
111 i == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC ||
112 i == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA ||
113 i == CONTENT_SETTINGS_TYPE_PPAPI_BROKER ||
114 i == CONTENT_SETTINGS_TYPE_MIDI_SYSEX ||
115 i == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING ||
116 i == CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS ||
117 i == CONTENT_SETTINGS_TYPE_APP_BANNER ||
118 i == CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT ||
119 i == CONTENT_SETTINGS_TYPE_DURABLE_STORAGE) {
120 // These types have no bubble.
121 continue; 109 continue;
122 } 110 ContentSettingBubbleController* controller = CreateBubbleController(type);
123
124 ContentSettingsType settingsType = static_cast<ContentSettingsType>(i);
125
126 ContentSettingBubbleController* controller =
127 CreateBubbleController(settingsType);
128 EXPECT_EQ(0u, [controller mediaMenus]->size()); 111 EXPECT_EQ(0u, [controller mediaMenus]->size());
129 [parent_ close]; 112 [parent_ close];
130 } 113 }
131 } 114 }
132 115
133 // Check that the bubble works for CONTENT_SETTINGS_TYPE_MEDIASTREAM. 116 // Check that the bubble works for CONTENT_SETTINGS_TYPE_MEDIASTREAM.
134 TEST_F(ContentSettingBubbleControllerTest, MediaStreamBubble) { 117 TEST_F(ContentSettingBubbleControllerTest, MediaStreamBubble) {
135 MediaCaptureDevicesDispatcher::GetInstance()-> 118 MediaCaptureDevicesDispatcher::GetInstance()->
136 DisableDeviceEnumerationForTesting(); 119 DisableDeviceEnumerationForTesting();
137 ContentSettingBubbleController* controller = 120 ContentSettingBubbleController* controller =
138 CreateBubbleController(CONTENT_SETTINGS_TYPE_MEDIASTREAM); 121 CreateBubbleController(CONTENT_SETTINGS_TYPE_MEDIASTREAM);
139 content_setting_bubble::MediaMenuPartsMap* mediaMenus = 122 content_setting_bubble::MediaMenuPartsMap* mediaMenus =
140 [controller mediaMenus]; 123 [controller mediaMenus];
141 EXPECT_EQ(2u, mediaMenus->size()); 124 EXPECT_EQ(2u, mediaMenus->size());
142 NSString* title = l10n_util::GetNSString(IDS_MEDIA_MENU_NO_DEVICE_TITLE); 125 NSString* title = l10n_util::GetNSString(IDS_MEDIA_MENU_NO_DEVICE_TITLE);
143 for (content_setting_bubble::MediaMenuPartsMap::const_iterator i = 126 for (content_setting_bubble::MediaMenuPartsMap::const_iterator i =
144 mediaMenus->begin(); i != mediaMenus->end(); ++i) { 127 mediaMenus->begin(); i != mediaMenus->end(); ++i) {
145 EXPECT_TRUE((content::MEDIA_DEVICE_AUDIO_CAPTURE == i->second->type) || 128 EXPECT_TRUE((content::MEDIA_DEVICE_AUDIO_CAPTURE == i->second->type) ||
146 (content::MEDIA_DEVICE_VIDEO_CAPTURE == i->second->type)); 129 (content::MEDIA_DEVICE_VIDEO_CAPTURE == i->second->type));
147 EXPECT_EQ(0, [i->first numberOfItems]); 130 EXPECT_EQ(0, [i->first numberOfItems]);
148 EXPECT_NSEQ(title, [i->first title]); 131 EXPECT_NSEQ(title, [i->first title]);
149 EXPECT_FALSE([i->first isEnabled]); 132 EXPECT_FALSE([i->first isEnabled]);
150 } 133 }
151 134
152 [parent_ close]; 135 [parent_ close];
153 } 136 }
154 137
155 } // namespace 138 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698