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

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

Issue 216052: Mac: Empty bookmark bar should show IDS_BOOKMARKS_NO_ITEMS. (Closed)
Patch Set: Committed ver. Created 11 years, 3 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/scoped_nsobject.h" 8 #include "base/scoped_nsobject.h"
9 #import "chrome/browser/cocoa/bookmark_bar_controller.h" 9 #import "chrome/browser/cocoa/bookmark_bar_controller.h"
10 #import "chrome/browser/cocoa/bookmark_bar_view.h"
10 #include "chrome/browser/cocoa/browser_test_helper.h" 11 #include "chrome/browser/cocoa/browser_test_helper.h"
11 #import "chrome/browser/cocoa/cocoa_test_helper.h" 12 #import "chrome/browser/cocoa/cocoa_test_helper.h"
12 #include "chrome/browser/cocoa/test_event_utils.h" 13 #include "chrome/browser/cocoa/test_event_utils.h"
13 #import "chrome/browser/cocoa/view_resizer_pong.h" 14 #import "chrome/browser/cocoa/view_resizer_pong.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "testing/platform_test.h" 16 #include "testing/platform_test.h"
16 17
17 // Pretend BookmarkURLOpener delegate to keep track of requests 18 // Pretend BookmarkURLOpener delegate to keep track of requests
18 @interface BookmarkURLOpenerPong : NSObject<BookmarkURLOpener> { 19 @interface BookmarkURLOpenerPong : NSObject<BookmarkURLOpener> {
19 @public 20 @public
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 } 561 }
561 EXPECT_GE(num_off_the_side, 20); 562 EXPECT_GE(num_off_the_side, 20);
562 563
563 // Reset, and check that the built menu is "empty" again. 564 // Reset, and check that the built menu is "empty" again.
564 [bar_ clearBookmarkBar]; 565 [bar_ clearBookmarkBar];
565 EXPECT_EQ(0U, [[bar_ buttons] count]); 566 EXPECT_EQ(0U, [[bar_ buttons] count]);
566 [bar_ buildOffTheSideMenu]; 567 [bar_ buildOffTheSideMenu];
567 EXPECT_EQ(1, [menu numberOfItems]); 568 EXPECT_EQ(1, [menu numberOfItems]);
568 } 569 }
569 570
571 TEST_F(BookmarkBarControllerTest, DisplaysHelpMessageOnEmpty) {
572 BookmarkModel* model = helper_.profile()->GetBookmarkModel();
573 [bar_ loaded:model];
574 EXPECT_FALSE([[[bar_ buttonView] noItemTextfield] isHidden]);
575 }
576
577 TEST_F(BookmarkBarControllerTest, HidesHelpMessageWithBookmark) {
578 BookmarkModel* model = helper_.profile()->GetBookmarkModel();
579
580 const BookmarkNode* parent = model->GetBookmarkBarNode();
581 model->AddURL(parent, parent->GetChildCount(),
582 L"title", GURL("http://one.com"));
583
584 [bar_ loaded:model];
585 EXPECT_TRUE([[[bar_ buttonView] noItemTextfield] isHidden]);
586 }
587
570 // Cannot test these methods since they simply call a single static 588 // Cannot test these methods since they simply call a single static
571 // method, BookmarkEditor::Show(), which is impossible to mock. 589 // method, BookmarkEditor::Show(), which is impossible to mock.
572 // editBookmark:, addPage: 590 // editBookmark:, addPage:
573 591
574 592
575 } // namespace 593 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.mm ('k') | chrome/browser/cocoa/bookmark_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698