OLD | NEW |
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/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 TEST_F(BookmarkBubbleControllerTest, SyncPromoNotSignedIn) { | 461 TEST_F(BookmarkBubbleControllerTest, SyncPromoNotSignedIn) { |
462 const BookmarkNode* node = CreateTestBookmark(); | 462 const BookmarkNode* node = CreateTestBookmark(); |
463 BookmarkBubbleController* controller = ControllerForNode(node); | 463 BookmarkBubbleController* controller = ControllerForNode(node); |
464 | 464 |
465 EXPECT_EQ(1u, [[controller.syncPromoPlaceholder subviews] count]); | 465 EXPECT_EQ(1u, [[controller.syncPromoPlaceholder subviews] count]); |
466 } | 466 } |
467 | 467 |
468 // Confirm that the sync promo is not displayed when the user is signed in. | 468 // Confirm that the sync promo is not displayed when the user is signed in. |
469 TEST_F(BookmarkBubbleControllerTest, SyncPromoSignedIn) { | 469 TEST_F(BookmarkBubbleControllerTest, SyncPromoSignedIn) { |
470 SigninManager* signin = SigninManagerFactory::GetForProfile(profile()); | 470 SigninManager* signin = SigninManagerFactory::GetForProfile(profile()); |
471 signin->SetAuthenticatedUsername("fake_username"); | 471 signin->SetAuthenticatedAccountInfo("fake_username", "fake_username"); |
472 | 472 |
473 const BookmarkNode* node = CreateTestBookmark(); | 473 const BookmarkNode* node = CreateTestBookmark(); |
474 BookmarkBubbleController* controller = ControllerForNode(node); | 474 BookmarkBubbleController* controller = ControllerForNode(node); |
475 | 475 |
476 EXPECT_EQ(0u, [[controller.syncPromoPlaceholder subviews] count]); | 476 EXPECT_EQ(0u, [[controller.syncPromoPlaceholder subviews] count]); |
477 } | 477 } |
478 | 478 |
479 } // namespace | 479 } // namespace |
480 | 480 |
481 @implementation NSApplication (BookmarkBubbleUnitTest) | 481 @implementation NSApplication (BookmarkBubbleUnitTest) |
482 // Add handler for the editBookmarkNode: action to NSApp for testing purposes. | 482 // Add handler for the editBookmarkNode: action to NSApp for testing purposes. |
483 // Normally this would be sent up the responder tree correctly, but since | 483 // Normally this would be sent up the responder tree correctly, but since |
484 // tests run in the background, key window and main window are never set on | 484 // tests run in the background, key window and main window are never set on |
485 // NSApplication. Adding it to NSApplication directly removes the need for | 485 // NSApplication. Adding it to NSApplication directly removes the need for |
486 // worrying about what the current window with focus is. | 486 // worrying about what the current window with focus is. |
487 - (void)editBookmarkNode:(id)sender { | 487 - (void)editBookmarkNode:(id)sender { |
488 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); | 488 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); |
489 BookmarkBubbleControllerTest::edits_++; | 489 BookmarkBubbleControllerTest::edits_++; |
490 } | 490 } |
491 | 491 |
492 @end | 492 @end |
OLD | NEW |