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

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

Issue 112913004: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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
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 <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/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/task_manager/resource_provider.h" 9 #include "chrome/browser/task_manager/resource_provider.h"
10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 TaskManagerMac* bridge(new TaskManagerMac(&task_manager)); 52 TaskManagerMac* bridge(new TaskManagerMac(&task_manager));
53 TaskManagerWindowController* controller = bridge->cocoa_controller(); 53 TaskManagerWindowController* controller = bridge->cocoa_controller();
54 54
55 // Releases the controller, which in turn deletes |bridge|. 55 // Releases the controller, which in turn deletes |bridge|.
56 [controller close]; 56 [controller close];
57 } 57 }
58 58
59 TEST_F(TaskManagerWindowControllerTest, Sort) { 59 TEST_F(TaskManagerWindowControllerTest, Sort) {
60 TaskManager task_manager; 60 TaskManager task_manager;
61 61
62 TestResource resource1(UTF8ToUTF16("zzz"), 1); 62 TestResource resource1(base::UTF8ToUTF16("zzz"), 1);
63 TestResource resource2(UTF8ToUTF16("zzb"), 2); 63 TestResource resource2(base::UTF8ToUTF16("zzb"), 2);
64 TestResource resource3(UTF8ToUTF16("zza"), 2); 64 TestResource resource3(base::UTF8ToUTF16("zza"), 2);
65 65
66 task_manager.AddResource(&resource1); 66 task_manager.AddResource(&resource1);
67 task_manager.AddResource(&resource2); 67 task_manager.AddResource(&resource2);
68 task_manager.AddResource(&resource3); // Will be in the same group as 2. 68 task_manager.AddResource(&resource3); // Will be in the same group as 2.
69 69
70 TaskManagerMac* bridge(new TaskManagerMac(&task_manager)); 70 TaskManagerMac* bridge(new TaskManagerMac(&task_manager));
71 TaskManagerWindowController* controller = bridge->cocoa_controller(); 71 TaskManagerWindowController* controller = bridge->cocoa_controller();
72 NSTableView* table = [controller tableView]; 72 NSTableView* table = [controller tableView];
73 ASSERT_EQ(3, [controller numberOfRowsInTableView:table]); 73 ASSERT_EQ(3, [controller numberOfRowsInTableView:table]);
74 74
(...skipping 12 matching lines...) Expand all
87 [controller close]; 87 [controller close];
88 88
89 task_manager.RemoveResource(&resource1); 89 task_manager.RemoveResource(&resource1);
90 task_manager.RemoveResource(&resource2); 90 task_manager.RemoveResource(&resource2);
91 task_manager.RemoveResource(&resource3); 91 task_manager.RemoveResource(&resource3);
92 } 92 }
93 93
94 TEST_F(TaskManagerWindowControllerTest, SelectionAdaptsToSorting) { 94 TEST_F(TaskManagerWindowControllerTest, SelectionAdaptsToSorting) {
95 TaskManager task_manager; 95 TaskManager task_manager;
96 96
97 TestResource resource1(UTF8ToUTF16("yyy"), 1); 97 TestResource resource1(base::UTF8ToUTF16("yyy"), 1);
98 TestResource resource2(UTF8ToUTF16("aaa"), 2); 98 TestResource resource2(base::UTF8ToUTF16("aaa"), 2);
99 99
100 task_manager.AddResource(&resource1); 100 task_manager.AddResource(&resource1);
101 task_manager.AddResource(&resource2); 101 task_manager.AddResource(&resource2);
102 102
103 TaskManagerMac* bridge(new TaskManagerMac(&task_manager)); 103 TaskManagerMac* bridge(new TaskManagerMac(&task_manager));
104 TaskManagerWindowController* controller = bridge->cocoa_controller(); 104 TaskManagerWindowController* controller = bridge->cocoa_controller();
105 NSTableView* table = [controller tableView]; 105 NSTableView* table = [controller tableView];
106 ASSERT_EQ(2, [controller numberOfRowsInTableView:table]); 106 ASSERT_EQ(2, [controller numberOfRowsInTableView:table]);
107 107
108 // Select row 0 in the table (corresponds to row 1 in the model). 108 // Select row 0 in the table (corresponds to row 1 in the model).
109 [table selectRowIndexes:[NSIndexSet indexSetWithIndex:0] 109 [table selectRowIndexes:[NSIndexSet indexSetWithIndex:0]
110 byExtendingSelection:NO]; 110 byExtendingSelection:NO];
111 111
112 // Change the name of resource2 so that it becomes row 1 in the table. 112 // Change the name of resource2 so that it becomes row 1 in the table.
113 resource2.title_ = UTF8ToUTF16("zzz"); 113 resource2.title_ = base::UTF8ToUTF16("zzz");
114 bridge->task_manager()->model()->Refresh(); 114 bridge->task_manager()->model()->Refresh();
115 bridge->OnItemsChanged(1, 1); 115 bridge->OnItemsChanged(1, 1);
116 116
117 // Check that the selection has moved to row 1. 117 // Check that the selection has moved to row 1.
118 NSIndexSet* selection = [table selectedRowIndexes]; 118 NSIndexSet* selection = [table selectedRowIndexes];
119 ASSERT_EQ(1u, [selection count]); 119 ASSERT_EQ(1u, [selection count]);
120 EXPECT_EQ(1u, [selection firstIndex]); 120 EXPECT_EQ(1u, [selection firstIndex]);
121 121
122 // Releases the controller, which in turn deletes |bridge|. 122 // Releases the controller, which in turn deletes |bridge|.
123 [controller close]; 123 [controller close];
124 124
125 task_manager.RemoveResource(&resource1); 125 task_manager.RemoveResource(&resource1);
126 task_manager.RemoveResource(&resource2); 126 task_manager.RemoveResource(&resource2);
127 } 127 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_controller_unittest.mm ('k') | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698