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

Side by Side Diff: chrome/browser/ui/cocoa/history_menu_bridge_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 #include <vector> 6 #include <vector>
7 7
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 EXPECT_EQ(1, [menu numberOfItems]); 169 EXPECT_EQ(1, [menu numberOfItems]);
170 EXPECT_NSEQ(@"HEADER", 170 EXPECT_NSEQ(@"HEADER",
171 [[menu itemWithTag:HistoryMenuBridge::kVisited] title]); 171 [[menu itemWithTag:HistoryMenuBridge::kVisited] title]);
172 } 172 }
173 173
174 // Test that AddItemToMenu() properly adds HistoryItem objects as menus. 174 // Test that AddItemToMenu() properly adds HistoryItem objects as menus.
175 TEST_F(HistoryMenuBridgeTest, AddItemToMenu) { 175 TEST_F(HistoryMenuBridgeTest, AddItemToMenu) {
176 NSMenu* menu = [[[NSMenu alloc] initWithTitle:@"history foo"] autorelease]; 176 NSMenu* menu = [[[NSMenu alloc] initWithTitle:@"history foo"] autorelease];
177 177
178 const base::string16 short_url = ASCIIToUTF16("http://foo/"); 178 const base::string16 short_url = base::ASCIIToUTF16("http://foo/");
179 const base::string16 long_url = ASCIIToUTF16("http://super-duper-long-url--." 179 const base::string16 long_url = base::ASCIIToUTF16(
180 "http://super-duper-long-url--."
180 "that.cannot.possibly.fit.even-in-80-columns" 181 "that.cannot.possibly.fit.even-in-80-columns"
181 "or.be.reasonably-displayed-in-a-menu" 182 "or.be.reasonably-displayed-in-a-menu"
182 "without.looking-ridiculous.com/"); // 140 chars total 183 "without.looking-ridiculous.com/"); // 140 chars total
183 184
184 // HistoryItems are owned by the HistoryMenuBridge when AddItemToBridgeMenu() 185 // HistoryItems are owned by the HistoryMenuBridge when AddItemToBridgeMenu()
185 // is called, which places them into the |menu_item_map_|, which owns them. 186 // is called, which places them into the |menu_item_map_|, which owns them.
186 HistoryMenuBridge::HistoryItem* item1 = CreateItem(short_url); 187 HistoryMenuBridge::HistoryItem* item1 = CreateItem(short_url);
187 AddItemToBridgeMenu(item1, menu, 100, 0); 188 AddItemToBridgeMenu(item1, menu, 100, 0);
188 189
189 HistoryMenuBridge::HistoryItem* item2 = CreateItem(long_url); 190 HistoryMenuBridge::HistoryItem* item2 = CreateItem(long_url);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 EXPECT_TRUE([[submenu2 itemAtIndex:1] isSeparatorItem]); 323 EXPECT_TRUE([[submenu2 itemAtIndex:1] isSeparatorItem]);
323 EXPECT_NSEQ(@"magic", [[submenu2 itemAtIndex:2] title]); 324 EXPECT_NSEQ(@"magic", [[submenu2 itemAtIndex:2] title]);
324 EXPECT_NSEQ(@"goats", [[submenu2 itemAtIndex:3] title]); 325 EXPECT_NSEQ(@"goats", [[submenu2 itemAtIndex:3] title]);
325 EXPECT_NSEQ(@"teleporter", [[submenu2 itemAtIndex:4] title]); 326 EXPECT_NSEQ(@"teleporter", [[submenu2 itemAtIndex:4] title]);
326 } 327 }
327 328
328 // Tests that we properly request an icon from the FaviconService. 329 // Tests that we properly request an icon from the FaviconService.
329 TEST_F(HistoryMenuBridgeTest, GetFaviconForHistoryItem) { 330 TEST_F(HistoryMenuBridgeTest, GetFaviconForHistoryItem) {
330 // Create a fake item. 331 // Create a fake item.
331 HistoryMenuBridge::HistoryItem item; 332 HistoryMenuBridge::HistoryItem item;
332 item.title = ASCIIToUTF16("Title"); 333 item.title = base::ASCIIToUTF16("Title");
333 item.url = GURL("http://google.com"); 334 item.url = GURL("http://google.com");
334 335
335 // Request the icon. 336 // Request the icon.
336 GetFaviconForHistoryItem(&item); 337 GetFaviconForHistoryItem(&item);
337 338
338 // Make sure the item was modified properly. 339 // Make sure the item was modified properly.
339 EXPECT_TRUE(item.icon_requested); 340 EXPECT_TRUE(item.icon_requested);
340 EXPECT_NE(CancelableTaskTracker::kBadTaskId, item.icon_task_id); 341 EXPECT_NE(CancelableTaskTracker::kBadTaskId, item.icon_task_id);
341 } 342 }
342 343
(...skipping 14 matching lines...) Expand all
357 image_result.image = gfx::Image::CreateFrom1xBitmap(bitmap); 358 image_result.image = gfx::Image::CreateFrom1xBitmap(bitmap);
358 GotFaviconData(&item, image_result); 359 GotFaviconData(&item, image_result);
359 360
360 // Make sure the callback works. 361 // Make sure the callback works.
361 EXPECT_FALSE(item.icon_requested); 362 EXPECT_FALSE(item.icon_requested);
362 EXPECT_TRUE(item.icon.get()); 363 EXPECT_TRUE(item.icon.get());
363 EXPECT_TRUE([item.menu_item image]); 364 EXPECT_TRUE([item.menu_item image]);
364 } 365 }
365 366
366 } // namespace 367 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/external_protocol_dialog.mm ('k') | chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698