OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
10 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 browser_thread_(BrowserThread::UI, &message_loop_) { | 49 browser_thread_(BrowserThread::UI, &message_loop_) { |
50 } | 50 } |
51 | 51 |
52 ContentSettingBubbleControllerTest::~ContentSettingBubbleControllerTest() { | 52 ContentSettingBubbleControllerTest::~ContentSettingBubbleControllerTest() { |
53 } | 53 } |
54 | 54 |
55 // Check that the bubble doesn't crash or leak for any settings type | 55 // Check that the bubble doesn't crash or leak for any settings type |
56 TEST_F(ContentSettingBubbleControllerTest, Init) { | 56 TEST_F(ContentSettingBubbleControllerTest, Init) { |
57 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 57 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
58 if (i == CONTENT_SETTINGS_TYPE_NOTIFICATIONS || | 58 if (i == CONTENT_SETTINGS_TYPE_NOTIFICATIONS || |
59 i == CONTENT_SETTINGS_TYPE_INTENTS) | 59 i == CONTENT_SETTINGS_TYPE_INTENTS || |
60 continue; // Notifications and web intents have no bubble. | 60 i == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) { |
| 61 // Notifications, web intents and auto select certificate have no bubble. |
| 62 continue; |
| 63 } |
61 | 64 |
62 ContentSettingsType settingsType = static_cast<ContentSettingsType>(i); | 65 ContentSettingsType settingsType = static_cast<ContentSettingsType>(i); |
63 | 66 |
64 scoped_nsobject<NSWindow> parent([[NSWindow alloc] | 67 scoped_nsobject<NSWindow> parent([[NSWindow alloc] |
65 initWithContentRect:NSMakeRect(0, 0, 800, 600) | 68 initWithContentRect:NSMakeRect(0, 0, 800, 600) |
66 styleMask:NSBorderlessWindowMask | 69 styleMask:NSBorderlessWindowMask |
67 backing:NSBackingStoreBuffered | 70 backing:NSBackingStoreBuffered |
68 defer:NO]); | 71 defer:NO]); |
69 [parent setReleasedWhenClosed:NO]; | 72 [parent setReleasedWhenClosed:NO]; |
70 if (base::debug::BeingDebugged()) | 73 if (base::debug::BeingDebugged()) |
71 [parent.get() orderFront:nil]; | 74 [parent.get() orderFront:nil]; |
72 else | 75 else |
73 [parent.get() orderBack:nil]; | 76 [parent.get() orderBack:nil]; |
74 | 77 |
75 ContentSettingBubbleController* controller = [ContentSettingBubbleController | 78 ContentSettingBubbleController* controller = [ContentSettingBubbleController |
76 showForModel:new DummyContentSettingBubbleModel(contents_wrapper(), | 79 showForModel:new DummyContentSettingBubbleModel(contents_wrapper(), |
77 profile(), | 80 profile(), |
78 settingsType) | 81 settingsType) |
79 parentWindow:parent | 82 parentWindow:parent |
80 anchoredAt:NSMakePoint(50, 20)]; | 83 anchoredAt:NSMakePoint(50, 20)]; |
81 EXPECT_TRUE(controller != nil); | 84 EXPECT_TRUE(controller != nil); |
82 EXPECT_TRUE([[controller window] isVisible]); | 85 EXPECT_TRUE([[controller window] isVisible]); |
83 [parent.get() close]; | 86 [parent.get() close]; |
84 } | 87 } |
85 } | 88 } |
86 | 89 |
87 } // namespace | 90 } // namespace |
OLD | NEW |