| 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 #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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 model.AddInstalledService(string16(), GURL("http://example.com/intent.html"), | 104 model.AddInstalledService(string16(), GURL("http://example.com/intent.html"), |
| 105 WebIntentPickerModel::DISPOSITION_WINDOW); | 105 WebIntentPickerModel::DISPOSITION_WINDOW); |
| 106 | 106 |
| 107 [controller_ performLayoutWithModel:&model]; | 107 [controller_ performLayoutWithModel:&model]; |
| 108 | 108 |
| 109 CheckWindow(/*row_count=*/2); | 109 CheckWindow(/*row_count=*/2); |
| 110 } | 110 } |
| 111 | 111 |
| 112 TEST_F(WebIntentPickerSheetControllerTest, SuggestionView) { | 112 TEST_F(WebIntentPickerSheetControllerTest, SuggestionView) { |
| 113 WebIntentPickerModel model; | 113 WebIntentPickerModel model; |
| 114 | 114 std::vector<WebIntentPickerModel::SuggestedExtension> suggestions; |
| 115 model.AddSuggestedExtension(string16(), string16(), 2.5); | 115 suggestions.push_back(WebIntentPickerModel::SuggestedExtension( |
| 116 string16(), string16(), 2.5)); |
| 117 model.AddSuggestedExtensions(suggestions); |
| 116 [controller_ performLayoutWithModel:&model]; | 118 [controller_ performLayoutWithModel:&model]; |
| 117 | 119 |
| 118 // Get subviews. | 120 // Get subviews. |
| 119 NSArray* flip_views = [[window_ contentView] subviews]; | 121 NSArray* flip_views = [[window_ contentView] subviews]; |
| 120 NSArray* main_views = [[flip_views objectAtIndex:0] subviews]; | 122 NSArray* main_views = [[flip_views objectAtIndex:0] subviews]; |
| 121 | 123 |
| 122 // 2nd object should be the suggestion view, 3rd one is close button. | 124 // 2nd object should be the suggestion view, 3rd one is close button. |
| 123 ASSERT_TRUE([main_views count] > 2); | 125 ASSERT_TRUE([main_views count] > 2); |
| 124 ASSERT_TRUE([[main_views objectAtIndex:1] isKindOfClass:[NSView class]]); | 126 ASSERT_TRUE([[main_views objectAtIndex:1] isKindOfClass:[NSView class]]); |
| 125 NSView* suggest_view = [main_views objectAtIndex:1]; | 127 NSView* suggest_view = [main_views objectAtIndex:1]; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 177 |
| 176 // Empty picker dialog has two elements, title and body. | 178 // Empty picker dialog has two elements, title and body. |
| 177 ASSERT_EQ(2U, [[empty_dialog subviews] count]); | 179 ASSERT_EQ(2U, [[empty_dialog subviews] count]); |
| 178 | 180 |
| 179 // Both title and body are NSTextFields. | 181 // Both title and body are NSTextFields. |
| 180 ASSERT_TRUE([[[empty_dialog subviews] objectAtIndex:0] | 182 ASSERT_TRUE([[[empty_dialog subviews] objectAtIndex:0] |
| 181 isKindOfClass:[NSTextField class]]); | 183 isKindOfClass:[NSTextField class]]); |
| 182 ASSERT_TRUE([[[empty_dialog subviews] objectAtIndex:1] | 184 ASSERT_TRUE([[[empty_dialog subviews] objectAtIndex:1] |
| 183 isKindOfClass:[NSTextField class]]); | 185 isKindOfClass:[NSTextField class]]); |
| 184 } | 186 } |
| OLD | NEW |