summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 14:07:27 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 14:07:27 +0000
commitdd6190612ab61c2a42bdfd465c088e5cfa1fd41c (patch)
tree93d001ee0e0b0106fc13602dca516ec3cc5bbf85
parent02e2a3d61ac16d8a7714ab7e69821ce89ea00279 (diff)
downloadchromium_src-dd6190612ab61c2a42bdfd465c088e5cfa1fd41c.zip
chromium_src-dd6190612ab61c2a42bdfd465c088e5cfa1fd41c.tar.gz
chromium_src-dd6190612ab61c2a42bdfd465c088e5cfa1fd41c.tar.bz2
Mac/clang: First pass over unit_tests
Review URL: http://codereview.chromium.org/2876002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50590 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm26
-rw-r--r--chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm10
-rw-r--r--chrome/browser/cocoa/autocomplete_text_field_unittest.mm10
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller.h3
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller_unittest.mm14
-rw-r--r--chrome/browser/cocoa/bookmark_bar_folder_controller.h1
-rw-r--r--chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm5
-rw-r--r--chrome/browser/cocoa/download_util_mac_unittest.mm2
-rw-r--r--chrome/browser/cocoa/find_bar_cocoa_controller_unittest.mm8
-rw-r--r--chrome/browser/cocoa/find_bar_text_field_cell_unittest.mm3
-rw-r--r--chrome/browser/cocoa/location_bar_view_mac_unittest.mm8
-rw-r--r--chrome/browser/cocoa/styled_text_field_cell_unittest.mm3
-rw-r--r--chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc3
-rw-r--r--chrome/common/deprecated/event_sys_unittest.cc4
14 files changed, 45 insertions, 55 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm
index 56856dd..a715248 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm
@@ -100,7 +100,7 @@ class AutocompletePopupViewMacTest : public PlatformTest {
// text matches the input string, with the passed-in color, and
// nothing bolded.
TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringNoMatch) {
- const NSString* string = @"This is a test";
+ NSString* const string = @"This is a test";
AutocompleteMatch::ACMatchClassifications classifications;
NSAttributedString* decorated =
@@ -127,7 +127,7 @@ TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringNoMatch) {
// Identical to DecorateMatchedStringNoMatch, except test that URL
// style gets a different color than we passed in.
TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringURLNoMatch) {
- const NSString* string = @"This is a test";
+ NSString* const string = @"This is a test";
AutocompleteMatch::ACMatchClassifications classifications;
classifications.push_back(
@@ -156,7 +156,7 @@ TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringURLNoMatch) {
// Test that DIM doesn't have any impact - true at this time.
TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringDimNoMatch) {
- const NSString* string = @"This is a test";
+ NSString* const string = @"This is a test";
// Switch to DIM halfway through.
AutocompleteMatch::ACMatchClassifications classifications;
@@ -189,7 +189,7 @@ TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringDimNoMatch) {
// Test that the matched run gets bold-faced, but keeps the same
// color.
TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringMatch) {
- const NSString* string = @"This is a test";
+ NSString* const string = @"This is a test";
// Match "is".
const NSUInteger runLength1 = 5, runLength2 = 2, runLength3 = 7;
// Make sure nobody messed up the inputs.
@@ -237,7 +237,7 @@ TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringMatch) {
// Just like DecorateMatchedStringURLMatch, this time with URL style.
TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringURLMatch) {
- const NSString* string = @"http://hello.world/";
+ NSString* const string = @"http://hello.world/";
// Match "hello".
const NSUInteger runLength1 = 7, runLength2 = 5, runLength3 = 7;
// Make sure nobody messed up the inputs.
@@ -288,8 +288,8 @@ TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringURLMatch) {
// something separating them. Not being specific about the separator
// on purpose, in case it changes.
TEST_F(AutocompletePopupViewMacTest, MatchText) {
- const NSString* contents = @"contents";
- const NSString* description = @"description";
+ NSString* const contents = @"contents";
+ NSString* const description = @"description";
AutocompleteMatch m = MakeMatch(base::SysNSStringToWide(contents),
base::SysNSStringToWide(description));
@@ -320,7 +320,7 @@ TEST_F(AutocompletePopupViewMacTest, MatchText) {
// Check that MatchText() styles content matches as expected.
TEST_F(AutocompletePopupViewMacTest, MatchTextContentsMatch) {
- const NSString* contents = @"This is a test";
+ NSString* const contents = @"This is a test";
// Match "is".
const NSUInteger runLength1 = 5, runLength2 = 2, runLength3 = 7;
// Make sure nobody messed up the inputs.
@@ -367,8 +367,8 @@ TEST_F(AutocompletePopupViewMacTest, MatchTextContentsMatch) {
// Check that MatchText() styles description matches as expected.
TEST_F(AutocompletePopupViewMacTest, MatchTextDescriptionMatch) {
- const NSString* contents = @"This is a test";
- const NSString* description = @"That was a test";
+ NSString* const contents = @"This is a test";
+ NSString* const description = @"That was a test";
// Match "That was".
const NSUInteger runLength1 = 8, runLength2 = 7;
// Make sure nobody messed up the inputs.
@@ -420,7 +420,7 @@ TEST_F(AutocompletePopupViewMacTest, MatchTextDescriptionMatch) {
}
TEST_F(AutocompletePopupViewMacTest, ElideString) {
- const NSString* contents = @"This is a test with long contents";
+ NSString* const contents = @"This is a test with long contents";
const std::wstring wideContents(base::SysNSStringToWide(contents));
const float kWide = 1000.0;
@@ -455,8 +455,8 @@ TEST_F(AutocompletePopupViewMacTest, ElideString) {
}
TEST_F(AutocompletePopupViewMacTest, MatchTextElide) {
- const NSString* contents = @"This is a test with long contents";
- const NSString* description = @"That was a test";
+ NSString* const contents = @"This is a test with long contents";
+ NSString* const description = @"That was a test";
// Match "long".
const NSUInteger runLength1 = 20, runLength2 = 4, runLength3 = 9;
// Make sure nobody messed up the inputs.
diff --git a/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm b/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm
index 5bd02cc..8f79424 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm
@@ -435,8 +435,8 @@ TEST_F(AutocompleteTextFieldCellTest, UsesPartialKeywordIfNarrow) {
AutocompleteTextFieldCell* cell =
static_cast<AutocompleteTextFieldCell*>([view_ cell]);
- const NSString* kFullString = @"Search Engine:";
- const NSString* kPartialString = @"Search Eng:";
+ NSString* const kFullString = @"Search Engine:";
+ NSString* const kPartialString = @"Search Eng:";
// Wide width chooses the full string, including an image on the
// left.
@@ -477,7 +477,7 @@ TEST_F(AutocompleteTextFieldCellTest, OmitsSearchHintIfNarrow) {
AutocompleteTextFieldCell* cell =
static_cast<AutocompleteTextFieldCell*>([view_ cell]);
- const NSString* kSearchHint = @"Type to search";
+ NSString* const kSearchHint = @"Type to search";
// Wide width chooses the full string.
[cell setSearchHintString:kSearchHint availableWidth:kWidth];
@@ -497,8 +497,8 @@ TEST_F(AutocompleteTextFieldCellTest, TrimsKeywordHintIfNarrow) {
scoped_nsobject<NSImage> image(
[[NSImage alloc] initWithSize:NSMakeSize(20, 20)]);
- const NSString* kHintPrefix = @"Press ";
- const NSString* kHintSuffix = @" to search Engine";
+ NSString* const kHintPrefix = @"Press ";
+ NSString* const kHintSuffix = @" to search Engine";
// Wide width chooses the full string.
[cell setKeywordHintPrefix:kHintPrefix image:image suffix:kHintSuffix
diff --git a/chrome/browser/cocoa/autocomplete_text_field_unittest.mm b/chrome/browser/cocoa/autocomplete_text_field_unittest.mm
index 1f3ecd3..d12c2dd 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_unittest.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field_unittest.mm
@@ -356,7 +356,7 @@ TEST_F(AutocompleteTextFieldTest, ResetFieldEditorBase) {
TEST_F(AutocompleteTextFieldTest, ResetFieldEditorSearchHint) {
AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell];
- const NSString* kHintString(@"Type to search");
+ NSString* const kHintString = @"Type to search";
// Capture the editor frame resulting from the standard focus
// machinery.
@@ -388,8 +388,8 @@ TEST_F(AutocompleteTextFieldTest, ResetFieldEditorSearchHint) {
TEST_F(AutocompleteTextFieldTest, ResetFieldEditorKeywordHint) {
AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell];
- const NSString* kFullString(@"Search Engine:");
- const NSString* kPartialString(@"Search Eng:");
+ NSString* const kFullString = @"Search Engine:";
+ NSString* const kPartialString = @"Search Eng:";
// Capture the editor frame resulting from the standard focus
// machinery.
@@ -749,7 +749,7 @@ TEST_F(AutocompleteTextFieldTest, SetAttributedStringBaseline) {
NSDictionary* attributes =
[NSDictionary dictionaryWithObject:font
forKey:NSFontAttributeName];
- static const NSString* kString = @"This is a test";
+ NSString* const kString = @"This is a test";
scoped_nsobject<NSAttributedString> attributedString(
[[NSAttributedString alloc] initWithString:kString
attributes:attributes]);
@@ -782,7 +782,7 @@ TEST_F(AutocompleteTextFieldTest, SetAttributedStringUndo) {
NSDictionary* attributes =
[NSDictionary dictionaryWithObject:redColor
forKey:NSForegroundColorAttributeName];
- static const NSString* kString = @"This is a test";
+ NSString* const kString = @"This is a test";
scoped_nsobject<NSAttributedString> attributedString(
[[NSAttributedString alloc] initWithString:kString
attributes:attributes]);
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.h b/chrome/browser/cocoa/bookmark_bar_controller.h
index 48e19b3..048333d 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller.h
+++ b/chrome/browser/cocoa/bookmark_bar_controller.h
@@ -128,7 +128,8 @@ willAnimateFromState:(bookmarks::VisualState)oldState
BookmarkBarToolbarViewController,
BookmarkButtonDelegate,
BookmarkButtonControllerProtocol,
- CrApplicationEventHookProtocol> {
+ CrApplicationEventHookProtocol,
+ NSUserInterfaceValidations> {
@private
// The visual state of the bookmark bar. If an animation is running, this is
// set to the "destination" and |lastVisualState_| is set to the "original"
diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
index 616753e..82dfe0d 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
@@ -252,19 +252,12 @@ class BookmarkBarControllerTestBase : public CocoaTest {
BrowserTestHelper helper_;
scoped_nsobject<NSView> parent_view_;
scoped_nsobject<ViewResizerPong> resizeDelegate_;
- scoped_nsobject<BookmarkBarController> bar_;
BookmarkBarControllerTestBase() {
resizeDelegate_.reset([[ViewResizerPong alloc] init]);
NSRect parent_frame = NSMakeRect(0, 0, 800, 50);
parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]);
[parent_view_ setHidden:YES];
- bar_.reset([[BookmarkBarController alloc]
- initWithBrowser:helper_.browser()
- initialWidth:NSWidth(parent_frame)
- delegate:nil
- resizeDelegate:resizeDelegate_.get()]);
- InstallAndToggleBar(bar_.get());
}
void InstallAndToggleBar(BookmarkBarController* bar) {
@@ -295,6 +288,7 @@ class BookmarkBarControllerTest : public BookmarkBarControllerTestBase {
scoped_nsobject<BookmarkMenu> menu_;
scoped_nsobject<NSMenuItem> menu_item_;
scoped_nsobject<NSButtonCell> cell_;
+ scoped_nsobject<BookmarkBarControllerNoOpen> bar_;
BookmarkBarControllerTest() {
bar_.reset(
@@ -754,9 +748,7 @@ TEST_F(BookmarkBarControllerTest, OpenBookmarkFromMenus) {
WindowOpenDisposition dispositions[] = { NEW_FOREGROUND_TAB,
NEW_WINDOW,
OFF_THE_RECORD };
- for (unsigned int i = 0;
- i < sizeof(dispositions)/sizeof(dispositions[0]);
- i++) {
+ for (unsigned int i = 0; i < arraysize(dispositions); i++) {
GURL gurl(urls[i]);
[bar_ performSelector:selectors[i]
withObject:ItemForBookmarkBarMenu(gurl)];
@@ -1829,6 +1821,8 @@ TEST_F(BookmarkBarControllerNotificationTest, DeregistersForNotifications) {
class BookmarkBarControllerDragDropTest : public BookmarkBarControllerTestBase {
public:
+ scoped_nsobject<BookmarkBarControllerDragData> bar_;
+
BookmarkBarControllerDragDropTest() {
bar_.reset(
[[BookmarkBarControllerDragData alloc]
diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller.h b/chrome/browser/cocoa/bookmark_bar_folder_controller.h
index cd48b56..1a33490 100644
--- a/chrome/browser/cocoa/bookmark_bar_folder_controller.h
+++ b/chrome/browser/cocoa/bookmark_bar_folder_controller.h
@@ -171,5 +171,6 @@
// Return YES if the scrollable_ flag has been set.
- (BOOL)scrollable;
+- (BookmarkButton*)buttonForDroppingOnAtPoint:(NSPoint)point;
@end
diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm
index 8cefd96..39546df 100644
--- a/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm
+++ b/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm
@@ -146,10 +146,10 @@ class BookmarkBarFolderControllerTest : public CocoaTest {
// Return a simple BookmarkBarFolderController.
- BookmarkBarFolderController* SimpleBookmarkBarFolderController() {
+ BookmarkBarFolderControllerPong* SimpleBookmarkBarFolderController() {
BookmarkButton* parentButton = [[parentBarController_ buttons]
objectAtIndex:0];
- BookmarkBarFolderController* c =
+ BookmarkBarFolderControllerPong* c =
[[BookmarkBarFolderControllerPong alloc]
initWithParentButton:parentButton
parentController:nil
@@ -638,7 +638,6 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToSubfolder) {
BookmarkButton* toSubfolder =
[folderController buttonWithTitleEqualTo:@"4f2f"];
ASSERT_TRUE(toSubfolder);
- NSRect oldToSubfolderFrame = [toSubfolder frame];
[[toSubfolder target] performSelector:@selector(openBookmarkFolderFromButton:)
withObject:toSubfolder];
BookmarkBarFolderController* subfolderController =
diff --git a/chrome/browser/cocoa/download_util_mac_unittest.mm b/chrome/browser/cocoa/download_util_mac_unittest.mm
index 85835e0..8a3a90c 100644
--- a/chrome/browser/cocoa/download_util_mac_unittest.mm
+++ b/chrome/browser/cocoa/download_util_mac_unittest.mm
@@ -24,7 +24,7 @@ class DownloadUtilTest : public CocoaTest {
[pasteboard_ releaseGlobally];
}
- const NSPasteboard* const pasteboard() { return pasteboard_; }
+ NSPasteboard* const pasteboard() { return pasteboard_; }
private:
NSPasteboard* pasteboard_;
diff --git a/chrome/browser/cocoa/find_bar_cocoa_controller_unittest.mm b/chrome/browser/cocoa/find_bar_cocoa_controller_unittest.mm
index c45c009..6532371 100644
--- a/chrome/browser/cocoa/find_bar_cocoa_controller_unittest.mm
+++ b/chrome/browser/cocoa/find_bar_cocoa_controller_unittest.mm
@@ -29,7 +29,7 @@
return [findText_ stringValue];
}
-- (NSTextField*)findTextField {
+- (FindBarTextField*)findTextField {
return findText_;
}
@end
@@ -73,7 +73,7 @@ TEST_F(FindBarCocoaControllerTest, SetFindText) {
EXPECT_TRUE([controller_ isFindBarVisible]);
// Set the find text.
- const NSString* kFindText = @"Google";
+ NSString* const kFindText = @"Google";
[controller_ setFindText:kFindText];
EXPECT_EQ(
NSOrderedSame,
@@ -103,7 +103,7 @@ TEST_F(FindBarCocoaControllerTest, FindTextIsGlobal) {
// Setting the text in one controller should update the other controller's
// text as well.
- const NSString* kFindText = @"Respect to the man in the ice cream van";
+ NSString* const kFindText = @"Respect to the man in the ice cream van";
[controller_ setFindText:kFindText];
EXPECT_EQ(
NSOrderedSame,
@@ -114,7 +114,7 @@ TEST_F(FindBarCocoaControllerTest, FindTextIsGlobal) {
}
TEST_F(FindBarCocoaControllerTest, SettingFindTextUpdatesFindPboard) {
- const NSString* kFindText =
+ NSString* const kFindText =
@"It's not a bird, it's not a plane, it must be Dave who's on the train";
[controller_ setFindText:kFindText];
EXPECT_EQ(
diff --git a/chrome/browser/cocoa/find_bar_text_field_cell_unittest.mm b/chrome/browser/cocoa/find_bar_text_field_cell_unittest.mm
index 50011a4..56864dc 100644
--- a/chrome/browser/cocoa/find_bar_text_field_cell_unittest.mm
+++ b/chrome/browser/cocoa/find_bar_text_field_cell_unittest.mm
@@ -122,9 +122,6 @@ TEST_F(FindBarTextFieldCellTest, DrawingRectForBounds) {
NSRect textFrame = [cell_ textFrameForFrame:bounds];
NSRect drawingRect = [cell_ drawingRectForBounds:bounds];
- // Save the starting frame for after clear.
- const NSRect originalDrawingRect(drawingRect);
-
EXPECT_FALSE(NSIsEmptyRect(drawingRect));
EXPECT_TRUE(NSContainsRect(textFrame, NSInsetRect(drawingRect, 1, 1)));
diff --git a/chrome/browser/cocoa/location_bar_view_mac_unittest.mm b/chrome/browser/cocoa/location_bar_view_mac_unittest.mm
index c3b1f9a6..f82a2dd 100644
--- a/chrome/browser/cocoa/location_bar_view_mac_unittest.mm
+++ b/chrome/browser/cocoa/location_bar_view_mac_unittest.mm
@@ -81,11 +81,11 @@ TEST_F(LocationBarViewMacTest, OnChangedImpl) {
NSImage* image = [NSImage imageNamed:@"NSApplicationIcon"];
const std::wstring kKeyword(L"Google");
- const NSString* kKeywordPrefix = @"Press ";
- const NSString* kKeywordSuffix = @" to search Google";
- const NSString* kKeywordString = @"Search Google:";
+ NSString* const kKeywordPrefix = @"Press ";
+ NSString* const kKeywordSuffix = @" to search Google";
+ NSString* const kKeywordString = @"Search Google:";
// 0x2026 is Unicode ellipses.
- const NSString* kPartialString =
+ NSString* const kPartialString =
[NSString stringWithFormat:@"Search Go%C:", 0x2026];
// With no special hints requested, none set.
diff --git a/chrome/browser/cocoa/styled_text_field_cell_unittest.mm b/chrome/browser/cocoa/styled_text_field_cell_unittest.mm
index c087d28..8ee6c46 100644
--- a/chrome/browser/cocoa/styled_text_field_cell_unittest.mm
+++ b/chrome/browser/cocoa/styled_text_field_cell_unittest.mm
@@ -71,9 +71,6 @@ TEST_F(StyledTextFieldCellTest, DrawingRectForBounds) {
EXPECT_FALSE(NSIsEmptyRect(drawingRect));
EXPECT_TRUE(NSContainsRect(textFrame, NSInsetRect(drawingRect, 1, 1)));
- // Save the starting frame for after clear.
- const NSRect originalDrawingRect = drawingRect;
-
[cell_ setLeftMargin:10];
textFrame = [cell_ textFrameForFrame:bounds];
drawingRect = [cell_ drawingRectForBounds:bounds];
diff --git a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
index be08b4c6..5a2688d 100644
--- a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
+++ b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
@@ -99,7 +99,8 @@ void DevToolsRemoteListenSocketTester::TearDown() {
#if defined(OS_WIN)
closesocket(test_socket_);
#elif defined(OS_POSIX)
- HANDLE_EINTR(close(test_socket_));
+ int ret = HANDLE_EINTR(close(test_socket_));
+ ASSERT_EQ(ret, 0);
#endif
ASSERT_TRUE(NextAction(kDefaultTimeoutMs));
ASSERT_EQ(ACTION_CLOSE, last_action_.type());
diff --git a/chrome/common/deprecated/event_sys_unittest.cc b/chrome/common/deprecated/event_sys_unittest.cc
index b48eb49..622a689 100644
--- a/chrome/common/deprecated/event_sys_unittest.cc
+++ b/chrome/common/deprecated/event_sys_unittest.cc
@@ -178,8 +178,8 @@ class ThreadTester : public EventListener<TestEvent>,
ConditionVariable thread_running_cond(&thread_running_mutex);
ThreadArgs args;
ThreadInfo info;
- info.completed = false;
- args.completed = info.completed;
+ info.completed = NULL;
+ args.completed = false;
args.thread_running_cond = &(thread_running_cond);
args.thread_running_mutex = &(thread_running_mutex);
args.thread_running = false;