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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm

Issue 1302243002: [Mac] Remove kPulseBookmarkButtonNotification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bookmarkeditor
Patch Set: Fix test. Created 5 years, 4 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
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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 2079
2080 TEST_F(BookmarkBarControllerDragDropTest, PulseButton) { 2080 TEST_F(BookmarkBarControllerDragDropTest, PulseButton) {
2081 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); 2081 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
2082 const BookmarkNode* root = model->bookmark_bar_node(); 2082 const BookmarkNode* root = model->bookmark_bar_node();
2083 GURL gurl("http://www.google.com"); 2083 GURL gurl("http://www.google.com");
2084 const BookmarkNode* node = model->AddURL(root, root->child_count(), 2084 const BookmarkNode* node = model->AddURL(root, root->child_count(),
2085 ASCIIToUTF16("title"), gurl); 2085 ASCIIToUTF16("title"), gurl);
2086 2086
2087 BookmarkButton* button = [[bar_ buttons] objectAtIndex:0]; 2087 BookmarkButton* button = [[bar_ buttons] objectAtIndex:0];
2088 EXPECT_FALSE([button isContinuousPulsing]); 2088 EXPECT_FALSE([button isContinuousPulsing]);
2089 [bar_ startPulsingBookmarkNode:node];
2090 EXPECT_TRUE([button isContinuousPulsing]);
2091 [bar_ stopPulsingBookmarkNode:node];
2092 EXPECT_FALSE([button isContinuousPulsing]);
2089 2093
2090 NSValue *value = [NSValue valueWithPointer:node]; 2094 // Pulsing a node within a folder should pulse the folder button.
2091 NSDictionary *dict = [NSDictionary 2095 const BookmarkNode* folder =
2092 dictionaryWithObjectsAndKeys:value, 2096 model->AddFolder(root, root->child_count(), ASCIIToUTF16("folder"));
2093 bookmark_button::kBookmarkKey, 2097 const BookmarkNode* inner =
2094 [NSNumber numberWithBool:YES], 2098 model->AddURL(folder, folder->child_count(), ASCIIToUTF16("inner"), gurl);
2095 bookmark_button::kBookmarkPulseFlagKey,
2096 nil];
2097 [[NSNotificationCenter defaultCenter]
2098 postNotificationName:bookmark_button::kPulseBookmarkButtonNotification
2099 object:nil
2100 userInfo:dict];
2101 EXPECT_TRUE([button isContinuousPulsing]);
2102 2099
2103 dict = [NSDictionary dictionaryWithObjectsAndKeys:value, 2100 BookmarkButton* folder_button = [[bar_ buttons] objectAtIndex:1];
2104 bookmark_button::kBookmarkKey, 2101 EXPECT_FALSE([folder_button isContinuousPulsing]);
2105 [NSNumber numberWithBool:NO], 2102 [bar_ startPulsingBookmarkNode:inner];
2106 bookmark_button::kBookmarkPulseFlagKey, 2103 EXPECT_TRUE([folder_button isContinuousPulsing]);
2107 nil]; 2104 [bar_ stopPulsingBookmarkNode:folder];
2108 [[NSNotificationCenter defaultCenter] 2105 EXPECT_FALSE([folder_button isContinuousPulsing]);
2109 postNotificationName:bookmark_button::kPulseBookmarkButtonNotification
2110 object:nil
2111 userInfo:dict];
2112 EXPECT_FALSE([button isContinuousPulsing]);
2113 } 2106 }
2114 2107
2115 TEST_F(BookmarkBarControllerDragDropTest, DragBookmarkDataToTrash) { 2108 TEST_F(BookmarkBarControllerDragDropTest, DragBookmarkDataToTrash) {
2116 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile()); 2109 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
2117 const BookmarkNode* root = model->bookmark_bar_node(); 2110 const BookmarkNode* root = model->bookmark_bar_node();
2118 const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] " 2111 const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] "
2119 "2f3b ] 3b 4b "); 2112 "2f3b ] 3b 4b ");
2120 bookmarks::test::AddNodesFromModelString(model, root, model_string); 2113 bookmarks::test::AddNodesFromModelString(model, root, model_string);
2121 2114
2122 // Validate initial model. 2115 // Validate initial model.
(...skipping 16 matching lines...) Expand all
2139 "2f3b ] 4b "); 2132 "2f3b ] 4b ");
2140 actual = bookmarks::test::ModelStringFromNode(root); 2133 actual = bookmarks::test::ModelStringFromNode(root);
2141 EXPECT_EQ(expected, actual); 2134 EXPECT_EQ(expected, actual);
2142 2135
2143 // Verify that the other bookmark folder can't be deleted. 2136 // Verify that the other bookmark folder can't be deleted.
2144 BookmarkButton *otherButton = [bar_ otherBookmarksButton]; 2137 BookmarkButton *otherButton = [bar_ otherBookmarksButton];
2145 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]); 2138 EXPECT_FALSE([bar_ canDragBookmarkButtonToTrash:otherButton]);
2146 } 2139 }
2147 2140
2148 } // namespace 2141 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698