| 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #import "chrome/browser/extensions/extension_install_prompt.h" | 10 #import "chrome/browser/extensions/extension_install_prompt.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 | 205 |
| 206 // Test that we can load the inline prompt correctly, and that the outlets are | 206 // Test that we can load the inline prompt correctly, and that the outlets are |
| 207 // are hooked up. | 207 // are hooked up. |
| 208 TEST_F(ExtensionInstallViewControllerTest, BasicsInline) { | 208 TEST_F(ExtensionInstallViewControllerTest, BasicsInline) { |
| 209 chrome::MockExtensionInstallPromptDelegate delegate; | 209 chrome::MockExtensionInstallPromptDelegate delegate; |
| 210 | 210 |
| 211 // No warnings should trigger skinny prompt. | 211 // No warnings should trigger skinny prompt. |
| 212 ExtensionInstallPrompt::Prompt inline_prompt( | 212 ExtensionInstallPrompt::Prompt inline_prompt( |
| 213 ExtensionInstallPrompt::INLINE_INSTALL_PROMPT); | 213 ExtensionInstallPrompt::INLINE_INSTALL_PROMPT); |
| 214 inline_prompt.SetInlineInstallWebstoreData("1,000", true, 3.5, 200); | 214 inline_prompt.SetWebstoreData("1,000", true, 3.5, 200); |
| 215 inline_prompt.set_extension(extension_.get()); | 215 inline_prompt.set_extension(extension_.get()); |
| 216 inline_prompt.set_icon(chrome::LoadInstallPromptIcon()); | 216 inline_prompt.set_icon(chrome::LoadInstallPromptIcon()); |
| 217 | 217 |
| 218 base::scoped_nsobject<ExtensionInstallViewController> controller( | 218 base::scoped_nsobject<ExtensionInstallViewController> controller( |
| 219 [[ExtensionInstallViewController alloc] initWithNavigator:browser() | 219 [[ExtensionInstallViewController alloc] initWithNavigator:browser() |
| 220 delegate:&delegate | 220 delegate:&delegate |
| 221 prompt:inline_prompt]); | 221 prompt:inline_prompt]); |
| 222 | 222 |
| 223 [controller view]; // Force nib load. | 223 [controller view]; // Force nib load. |
| 224 | 224 |
| 225 // Test the right nib loaded. | 225 // Test the right nib loaded. |
| 226 EXPECT_NSEQ(@"ExtensionInstallPromptInline", [controller nibName]); | 226 EXPECT_NSEQ(@"ExtensionInstallPromptWebstoreData", [controller nibName]); |
| 227 | 227 |
| 228 // Check all the controls. | 228 // Check all the controls. |
| 229 EXPECT_TRUE([controller iconView]); | 229 EXPECT_TRUE([controller iconView]); |
| 230 EXPECT_TRUE([[controller iconView] image]); | 230 EXPECT_TRUE([[controller iconView] image]); |
| 231 | 231 |
| 232 EXPECT_TRUE([controller titleField]); | 232 EXPECT_TRUE([controller titleField]); |
| 233 EXPECT_NE(0u, [[[controller titleField] stringValue] length]); | 233 EXPECT_NE(0u, [[[controller titleField] stringValue] length]); |
| 234 | 234 |
| 235 EXPECT_TRUE([controller cancelButton]); | 235 EXPECT_TRUE([controller cancelButton]); |
| 236 EXPECT_NE(0u, [[[controller cancelButton] stringValue] length]); | 236 EXPECT_NE(0u, [[[controller cancelButton] stringValue] length]); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 [controller view]; // Force nib load. | 355 [controller view]; // Force nib load. |
| 356 | 356 |
| 357 NSOutlineView* outlineView = [controller outlineView]; | 357 NSOutlineView* outlineView = [controller outlineView]; |
| 358 EXPECT_TRUE(outlineView); | 358 EXPECT_TRUE(outlineView); |
| 359 EXPECT_EQ(4, [outlineView numberOfRows]); | 359 EXPECT_EQ(4, [outlineView numberOfRows]); |
| 360 EXPECT_NSEQ(base::SysUTF16ToNSString(prompt.GetPermissionsDetails(0)), | 360 EXPECT_NSEQ(base::SysUTF16ToNSString(prompt.GetPermissionsDetails(0)), |
| 361 [[outlineView dataSource] outlineView:outlineView | 361 [[outlineView dataSource] outlineView:outlineView |
| 362 objectValueForTableColumn:nil | 362 objectValueForTableColumn:nil |
| 363 byItem:[outlineView itemAtRow:2]]); | 363 byItem:[outlineView itemAtRow:2]]); |
| 364 } | 364 } |
| OLD | NEW |