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

Side by Side Diff: chrome/browser/cocoa/task_manager_mac_unittest.mm

Issue 3047055: Mac: Fix kill button and selection in task manager (Closed)
Patch Set: find-replace fail Created 10 years, 4 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
« no previous file with comments | « chrome/browser/cocoa/task_manager_mac.mm ('k') | chrome/browser/task_manager.h » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/scoped_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #import "chrome/browser/cocoa/task_manager_mac.h" 9 #import "chrome/browser/cocoa/task_manager_mac.h"
10 #import "chrome/browser/cocoa/cocoa_test_helper.h" 10 #import "chrome/browser/cocoa/cocoa_test_helper.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 cell = [controller tableView:table dataCellForTableColumn:title_column row:2]; 69 cell = [controller tableView:table dataCellForTableColumn:title_column row:2];
70 EXPECT_TRUE([@"zzz" isEqualToString:[cell title]]); 70 EXPECT_TRUE([@"zzz" isEqualToString:[cell title]]);
71 71
72 // Releases the controller, which in turn deletes |bridge|. 72 // Releases the controller, which in turn deletes |bridge|.
73 [controller close]; 73 [controller close];
74 74
75 task_manager.RemoveResource(&resource1); 75 task_manager.RemoveResource(&resource1);
76 task_manager.RemoveResource(&resource2); 76 task_manager.RemoveResource(&resource2);
77 task_manager.RemoveResource(&resource3); 77 task_manager.RemoveResource(&resource3);
78 } 78 }
79
80 TEST_F(TaskManagerWindowControllerTest, SelectionAdaptsToSorting) {
81 TaskManager task_manager;
82
83 TestResource resource1(UTF8ToUTF16("yyy"), 1);
84 TestResource resource2(UTF8ToUTF16("aaa"), 2);
85
86 task_manager.AddResource(&resource1);
87 task_manager.AddResource(&resource2);
88
89 TaskManagerMac* bridge(new TaskManagerMac(&task_manager));
90 TaskManagerWindowController* controller = bridge->cocoa_controller();
91 NSTableView* table = [controller tableView];
92 ASSERT_EQ(2, [controller numberOfRowsInTableView:table]);
93
94 // Select row 0 in the table (corresponds to row 1 in the model).
95 [table selectRowIndexes:[NSIndexSet indexSetWithIndex:0]
96 byExtendingSelection:NO];
97
98 // Change the name of resource2 so that it becomes row 1 in the table.
99 resource2.title_ = UTF8ToUTF16("zzz");
100 bridge->OnItemsChanged(1, 1);
101
102 // Check that the selection has moved to row 1.
103 NSIndexSet* selection = [table selectedRowIndexes];
104 ASSERT_EQ(1u, [selection count]);
105 EXPECT_EQ(1u, [selection firstIndex]);
106
107 // Releases the controller, which in turn deletes |bridge|.
108 [controller close];
109
110 task_manager.RemoveResource(&resource1);
111 task_manager.RemoveResource(&resource2);
112 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/task_manager_mac.mm ('k') | chrome/browser/task_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698