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 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #import "chrome/browser/ui/cocoa/task_manager_mac.h" | 10 #import "chrome/browser/ui/cocoa/task_manager_mac.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 task_manager.AddResource(&resource2); | 64 task_manager.AddResource(&resource2); |
65 task_manager.AddResource(&resource3); // Will be in the same group as 2. | 65 task_manager.AddResource(&resource3); // Will be in the same group as 2. |
66 | 66 |
67 TaskManagerMac* bridge(new TaskManagerMac(&task_manager, false)); | 67 TaskManagerMac* bridge(new TaskManagerMac(&task_manager, false)); |
68 TaskManagerWindowController* controller = bridge->cocoa_controller(); | 68 TaskManagerWindowController* controller = bridge->cocoa_controller(); |
69 NSTableView* table = [controller tableView]; | 69 NSTableView* table = [controller tableView]; |
70 ASSERT_EQ(3, [controller numberOfRowsInTableView:table]); | 70 ASSERT_EQ(3, [controller numberOfRowsInTableView:table]); |
71 | 71 |
72 // Test that table is sorted on title. | 72 // Test that table is sorted on title. |
73 NSTableColumn* title_column = [table tableColumnWithIdentifier: | 73 NSTableColumn* title_column = [table tableColumnWithIdentifier: |
74 [NSNumber numberWithInt:IDS_TASK_MANAGER_TASK_COLUMN]]; | 74 [NSString stringWithFormat:@"%d", IDS_TASK_MANAGER_TASK_COLUMN]]; |
75 NSCell* cell; | 75 NSCell* cell; |
76 cell = [controller tableView:table dataCellForTableColumn:title_column row:0]; | 76 cell = [controller tableView:table dataCellForTableColumn:title_column row:0]; |
77 EXPECT_NSEQ(@"zzb", [cell title]); | 77 EXPECT_NSEQ(@"zzb", [cell title]); |
78 cell = [controller tableView:table dataCellForTableColumn:title_column row:1]; | 78 cell = [controller tableView:table dataCellForTableColumn:title_column row:1]; |
79 EXPECT_NSEQ(@"zza", [cell title]); | 79 EXPECT_NSEQ(@"zza", [cell title]); |
80 cell = [controller tableView:table dataCellForTableColumn:title_column row:2]; | 80 cell = [controller tableView:table dataCellForTableColumn:title_column row:2]; |
81 EXPECT_NSEQ(@"zzz", [cell title]); | 81 EXPECT_NSEQ(@"zzz", [cell title]); |
82 | 82 |
83 // Releases the controller, which in turn deletes |bridge|. | 83 // Releases the controller, which in turn deletes |bridge|. |
84 [controller close]; | 84 [controller close]; |
(...skipping 29 matching lines...) Expand all Loading... |
114 NSIndexSet* selection = [table selectedRowIndexes]; | 114 NSIndexSet* selection = [table selectedRowIndexes]; |
115 ASSERT_EQ(1u, [selection count]); | 115 ASSERT_EQ(1u, [selection count]); |
116 EXPECT_EQ(1u, [selection firstIndex]); | 116 EXPECT_EQ(1u, [selection firstIndex]); |
117 | 117 |
118 // Releases the controller, which in turn deletes |bridge|. | 118 // Releases the controller, which in turn deletes |bridge|. |
119 [controller close]; | 119 [controller close]; |
120 | 120 |
121 task_manager.RemoveResource(&resource1); | 121 task_manager.RemoveResource(&resource1); |
122 task_manager.RemoveResource(&resource2); | 122 task_manager.RemoveResource(&resource2); |
123 } | 123 } |
OLD | NEW |