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

Side by Side Diff: chrome/browser/ui/cocoa/web_intent_sheet_controller_unittest.mm

Issue 10387141: [OSX, WebIntents] Display suggestions label, unless there are no suggestions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review nit. Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/web_intent_sheet_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/web_intent_sheet_controller.h" 5 #import "chrome/browser/ui/cocoa/web_intent_sheet_controller.h"
6 6
7 #include "base/memory/scoped_nsobject.h" 7 #include "base/memory/scoped_nsobject.h"
8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
9 #import "chrome/browser/ui/cocoa/hover_close_button.h" 9 #import "chrome/browser/ui/cocoa/hover_close_button.h"
10 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" 10 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 TEST_F(WebIntentPickerSheetControllerTest, SuggestionView) { 110 TEST_F(WebIntentPickerSheetControllerTest, SuggestionView) {
111 WebIntentPickerModel model; 111 WebIntentPickerModel model;
112 112
113 model.AddSuggestedExtension(string16(), string16(), 2.5); 113 model.AddSuggestedExtension(string16(), string16(), 2.5);
114 [controller_ performLayoutWithModel:&model]; 114 [controller_ performLayoutWithModel:&model];
115 115
116 // Get subviews. 116 // Get subviews.
117 NSArray* flip_views = [[window_ contentView] subviews]; 117 NSArray* flip_views = [[window_ contentView] subviews];
118 NSArray* main_views = [[flip_views objectAtIndex:0] subviews]; 118 NSArray* main_views = [[flip_views objectAtIndex:0] subviews];
119 119
120 // 4th object should be the suggestion view. 120 // 3rd object should be the suggestion view.
121 ASSERT_TRUE([main_views count] > 2); 121 ASSERT_TRUE([main_views count] > 2);
122 ASSERT_TRUE([[main_views objectAtIndex:2] isKindOfClass:[NSView class]]); 122 ASSERT_TRUE([[main_views objectAtIndex:2] isKindOfClass:[NSView class]]);
123 NSView* suggest_view = [main_views objectAtIndex:2]; 123 NSView* suggest_view = [main_views objectAtIndex:2];
124 124
125 // There is exactly one subview, which contains the suggested item. 125 // There are two subviews - label & suggested items.
126 ASSERT_EQ(1U, [[suggest_view subviews] count]); 126 ASSERT_EQ(2U, [[suggest_view subviews] count]);
127 ASSERT_TRUE([[[suggest_view subviews] objectAtIndex:1]
128 isKindOfClass:[NSTextField class]]);
127 ASSERT_TRUE([[[suggest_view subviews] objectAtIndex:0] 129 ASSERT_TRUE([[[suggest_view subviews] objectAtIndex:0]
128 isKindOfClass:[NSView class]]); 130 isKindOfClass:[NSView class]]);
129 NSView* item_view = [[suggest_view subviews] objectAtIndex:0]; 131 NSView* item_view = [[suggest_view subviews] objectAtIndex:0];
130 132
131 // 5 subobjects - Icon, title, star rating, add button, and throbber. 133 // 5 subobjects - Icon, title, star rating, add button, and throbber.
132 ASSERT_EQ(5U, [[item_view subviews] count]); 134 ASSERT_EQ(5U, [[item_view subviews] count]);
133 135
134 // Verify title button is hooked up properly 136 // Verify title button is hooked up properly
135 ASSERT_TRUE([[[item_view subviews] objectAtIndex:1] 137 ASSERT_TRUE([[[item_view subviews] objectAtIndex:1]
136 isKindOfClass:[NSButton class]]); 138 isKindOfClass:[NSButton class]]);
137 NSButton* title_button = [[item_view subviews] objectAtIndex:1]; 139 NSButton* title_button = [[item_view subviews] objectAtIndex:1];
138 CheckButton(title_button, @selector(openExtensionLink:)); 140 CheckButton(title_button, @selector(openExtensionLink:));
139 141
140 // Verify "Add to Chromium" button is hooked up properly 142 // Verify "Add to Chromium" button is hooked up properly
141 ASSERT_TRUE([[[item_view subviews] objectAtIndex:3] 143 ASSERT_TRUE([[[item_view subviews] objectAtIndex:3]
142 isKindOfClass:[NSButton class]]); 144 isKindOfClass:[NSButton class]]);
143 NSButton* add_button = [[item_view subviews] objectAtIndex:3]; 145 NSButton* add_button = [[item_view subviews] objectAtIndex:3];
144 CheckButton(add_button, @selector(installExtension:)); 146 CheckButton(add_button, @selector(installExtension:));
145 147
146 // Verify we have a throbber. 148 // Verify we have a throbber.
147 ASSERT_TRUE([[[item_view subviews] objectAtIndex:4] 149 ASSERT_TRUE([[[item_view subviews] objectAtIndex:4]
148 isKindOfClass:[NSProgressIndicator class]]); 150 isKindOfClass:[NSProgressIndicator class]]);
149 } 151 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/web_intent_sheet_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698