summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/history_menu_cocoa_controller_unittest.mm
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 14:56:07 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 14:56:07 +0000
commitac52801ffc2316ae5cc0aaf46880b41cec9d300a (patch)
tree0986fca0bc762a6bd5c419a6072821af4707d004 /chrome/browser/cocoa/history_menu_cocoa_controller_unittest.mm
parent28e139dac3b7ba085e04bcc2d5c79e09cc69527e (diff)
downloadchromium_src-ac52801ffc2316ae5cc0aaf46880b41cec9d300a.zip
chromium_src-ac52801ffc2316ae5cc0aaf46880b41cec9d300a.tar.gz
chromium_src-ac52801ffc2316ae5cc0aaf46880b41cec9d300a.tar.bz2
[Mac] Add favicons to the history menu
BUG=20464 TEST=Open History menu, see icons. Review URL: http://codereview.chromium.org/660250 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/history_menu_cocoa_controller_unittest.mm')
-rw-r--r--chrome/browser/cocoa/history_menu_cocoa_controller_unittest.mm26
1 files changed, 15 insertions, 11 deletions
diff --git a/chrome/browser/cocoa/history_menu_cocoa_controller_unittest.mm b/chrome/browser/cocoa/history_menu_cocoa_controller_unittest.mm
index 112f798..6bd64f5 100644
--- a/chrome/browser/cocoa/history_menu_cocoa_controller_unittest.mm
+++ b/chrome/browser/cocoa/history_menu_cocoa_controller_unittest.mm
@@ -1,7 +1,8 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/scoped_vector.h"
#include "base/sys_string_conversions.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/browser.h"
@@ -12,6 +13,7 @@
@interface FakeHistoryMenuController : HistoryMenuCocoaController {
@public
BOOL opened_[2];
+ ScopedVector<HistoryMenuBridge::HistoryItem> items_;
}
@end
@@ -25,22 +27,24 @@
return self;
}
-- (HistoryMenuBridge::HistoryItem)itemForTag:(NSInteger)tag {
- HistoryMenuBridge::HistoryItem item;
+- (HistoryMenuBridge::HistoryItem*)itemForTag:(NSInteger)tag {
+ HistoryMenuBridge::HistoryItem* item = new HistoryMenuBridge::HistoryItem();
if (tag == 0) {
- item.title = ASCIIToUTF16("uno");
- item.url = GURL("http://google.com");
+ item->title = ASCIIToUTF16("uno");
+ item->url = GURL("http://google.com");
} else if (tag == 1) {
- item.title = ASCIIToUTF16("duo");
- item.url = GURL("http://apple.com");
+ item->title = ASCIIToUTF16("duo");
+ item->url = GURL("http://apple.com");
} else {
NOTREACHED();
}
+ // We push the item into a scoped vector that will delete it on destruction.
+ items_.push_back(item);
return item;
}
-- (void)openURLForItem:(HistoryMenuBridge::HistoryItem&)item {
- std::string url = item.url.possibly_invalid_spec();
+- (void)openURLForItem:(HistoryMenuBridge::HistoryItem*)item {
+ std::string url = item->url.possibly_invalid_spec();
if (url.find("http://google.com") != std::string::npos)
opened_[0] = YES;
if (url.find("http://apple.com") != std::string::npos)
@@ -49,8 +53,8 @@
@end // FakeHistoryMenuController
-TEST(HistoryMenuCocoaControllerTest, TestOpenItem) {
- FakeHistoryMenuController *c = [[FakeHistoryMenuController alloc] init];
+TEST(HistoryMenuCocoaControllerTest, OpenURLForItem) {
+ FakeHistoryMenuController* c = [[FakeHistoryMenuController alloc] init];
NSMenuItem* item = [[[NSMenuItem alloc] init] autorelease];
for (int i = 0; i < 2; ++i) {
[item setTag:i];