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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_button_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 #include "base/mac/scoped_nsobject.h" 5 #include "base/mac/scoped_nsobject.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/bookmarks/bookmark_model.h" 7 #include "chrome/browser/bookmarks/bookmark_model.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Since this returns (does not actually begin a modal drag), success! 88 // Since this returns (does not actually begin a modal drag), success!
89 [button beginDrag:downEvent]; 89 [button beginDrag:downEvent];
90 90
91 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); 91 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
92 const BookmarkNode* node = model->bookmark_bar_node(); 92 const BookmarkNode* node = model->bookmark_bar_node();
93 [cell setBookmarkNode:node]; 93 [cell setBookmarkNode:node];
94 EXPECT_FALSE([button isEmpty]); 94 EXPECT_FALSE([button isEmpty]);
95 EXPECT_TRUE([button isFolder]); 95 EXPECT_TRUE([button isFolder]);
96 EXPECT_EQ([button bookmarkNode], node); 96 EXPECT_EQ([button bookmarkNode], node);
97 97
98 node = model->AddURL(node, 0, ASCIIToUTF16("hi mom"), 98 node = model->AddURL(node, 0, base::ASCIIToUTF16("hi mom"),
99 GURL("http://www.google.com")); 99 GURL("http://www.google.com"));
100 [cell setBookmarkNode:node]; 100 [cell setBookmarkNode:node];
101 EXPECT_FALSE([button isEmpty]); 101 EXPECT_FALSE([button isEmpty]);
102 EXPECT_FALSE([button isFolder]); 102 EXPECT_FALSE([button isFolder]);
103 EXPECT_EQ([button bookmarkNode], node); 103 EXPECT_EQ([button bookmarkNode], node);
104 } 104 }
105 105
106 TEST_F(BookmarkButtonTest, MouseEnterExitRedirect) { 106 TEST_F(BookmarkButtonTest, MouseEnterExitRedirect) {
107 NSEvent* moveEvent = 107 NSEvent* moveEvent =
108 cocoa_test_event_utils::MouseEventAtPoint(NSMakePoint(10,10), 108 cocoa_test_event_utils::MouseEventAtPoint(NSMakePoint(10,10),
(...skipping 27 matching lines...) Expand all
136 base::scoped_nsobject<FakeButtonDelegate> delegate( 136 base::scoped_nsobject<FakeButtonDelegate> delegate(
137 [[FakeButtonDelegate alloc] init]); 137 [[FakeButtonDelegate alloc] init]);
138 button.reset([[BookmarkButton alloc] initWithFrame:NSMakeRect(0,0,500,500)]); 138 button.reset([[BookmarkButton alloc] initWithFrame:NSMakeRect(0,0,500,500)]);
139 cell.reset([[BookmarkButtonCell alloc] initTextCell:@"hi mom"]); 139 cell.reset([[BookmarkButtonCell alloc] initTextCell:@"hi mom"]);
140 [button setCell:cell]; 140 [button setCell:cell];
141 [button setDelegate:delegate]; 141 [button setDelegate:delegate];
142 142
143 // Add a deletable bookmark to the button. 143 // Add a deletable bookmark to the button.
144 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); 144 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
145 const BookmarkNode* barNode = model->bookmark_bar_node(); 145 const BookmarkNode* barNode = model->bookmark_bar_node();
146 const BookmarkNode* node = model->AddURL(barNode, 0, ASCIIToUTF16("hi mom"), 146 const BookmarkNode* node = model->AddURL(barNode, 0,
147 base::ASCIIToUTF16("hi mom"),
147 GURL("http://www.google.com")); 148 GURL("http://www.google.com"));
148 [cell setBookmarkNode:node]; 149 [cell setBookmarkNode:node];
149 150
150 // Verify that if canDragBookmarkButtonToTrash is NO then the button can't 151 // Verify that if canDragBookmarkButtonToTrash is NO then the button can't
151 // be dragged to the trash. 152 // be dragged to the trash.
152 delegate.get()->canDragToTrash_ = NO; 153 delegate.get()->canDragToTrash_ = NO;
153 NSDragOperation operation = [button draggingSourceOperationMaskForLocal:NO]; 154 NSDragOperation operation = [button draggingSourceOperationMaskForLocal:NO];
154 EXPECT_EQ(0u, operation & NSDragOperationDelete); 155 EXPECT_EQ(0u, operation & NSDragOperationDelete);
155 operation = [button draggingSourceOperationMaskForLocal:YES]; 156 operation = [button draggingSourceOperationMaskForLocal:YES];
156 EXPECT_EQ(0u, operation & NSDragOperationDelete); 157 EXPECT_EQ(0u, operation & NSDragOperationDelete);
(...skipping 11 matching lines...) Expand all
168 EXPECT_EQ(0, delegate.get()->didDragToTrashCount_); 169 EXPECT_EQ(0, delegate.get()->didDragToTrashCount_);
169 [button draggedImage:nil endedAt:NSZeroPoint operation:NSDragOperationCopy]; 170 [button draggedImage:nil endedAt:NSZeroPoint operation:NSDragOperationCopy];
170 EXPECT_EQ(0, delegate.get()->didDragToTrashCount_); 171 EXPECT_EQ(0, delegate.get()->didDragToTrashCount_);
171 [button draggedImage:nil endedAt:NSZeroPoint operation:NSDragOperationMove]; 172 [button draggedImage:nil endedAt:NSZeroPoint operation:NSDragOperationMove];
172 EXPECT_EQ(0, delegate.get()->didDragToTrashCount_); 173 EXPECT_EQ(0, delegate.get()->didDragToTrashCount_);
173 [button draggedImage:nil endedAt:NSZeroPoint operation:NSDragOperationDelete]; 174 [button draggedImage:nil endedAt:NSZeroPoint operation:NSDragOperationDelete];
174 EXPECT_EQ(1, delegate.get()->didDragToTrashCount_); 175 EXPECT_EQ(1, delegate.get()->didDragToTrashCount_);
175 } 176 }
176 177
177 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698