OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 EXPECT_TRUE(controller); | 468 EXPECT_TRUE(controller); |
469 EXPECT_FALSE(IsWindowClosing()); | 469 EXPECT_FALSE(IsWindowClosing()); |
470 | 470 |
471 // We can't actually create a new tab here, e.g. | 471 // We can't actually create a new tab here, e.g. |
472 // helper_.browser()->AddTabWithURL(...); | 472 // helper_.browser()->AddTabWithURL(...); |
473 // Many of our browser objects (Browser, Profile, RequestContext) | 473 // Many of our browser objects (Browser, Profile, RequestContext) |
474 // are "just enough" to run tests without being complete. Instead | 474 // are "just enough" to run tests without being complete. Instead |
475 // we fake the notification that would be triggered by a tab | 475 // we fake the notification that would be triggered by a tab |
476 // creation. See TabContents::NotifyConnected(). | 476 // creation. See TabContents::NotifyConnected(). |
477 NotificationService::current()->Notify( | 477 NotificationService::current()->Notify( |
478 NotificationType::TAB_CONTENTS_CONNECTED, | 478 content::NOTIFICATION_TAB_CONTENTS_CONNECTED, |
479 Source<TabContents>(NULL), | 479 Source<TabContents>(NULL), |
480 NotificationService::NoDetails()); | 480 NotificationService::NoDetails()); |
481 | 481 |
482 // Confirm bubble going bye-bye. | 482 // Confirm bubble going bye-bye. |
483 EXPECT_TRUE(IsWindowClosing()); | 483 EXPECT_TRUE(IsWindowClosing()); |
484 } | 484 } |
485 | 485 |
486 | 486 |
487 } // namespace | 487 } // namespace |
488 | 488 |
489 @implementation NSApplication (BookmarkBubbleUnitTest) | 489 @implementation NSApplication (BookmarkBubbleUnitTest) |
490 // Add handler for the editBookmarkNode: action to NSApp for testing purposes. | 490 // Add handler for the editBookmarkNode: action to NSApp for testing purposes. |
491 // Normally this would be sent up the responder tree correctly, but since | 491 // Normally this would be sent up the responder tree correctly, but since |
492 // tests run in the background, key window and main window are never set on | 492 // tests run in the background, key window and main window are never set on |
493 // NSApplication. Adding it to NSApplication directly removes the need for | 493 // NSApplication. Adding it to NSApplication directly removes the need for |
494 // worrying about what the current window with focus is. | 494 // worrying about what the current window with focus is. |
495 - (void)editBookmarkNode:(id)sender { | 495 - (void)editBookmarkNode:(id)sender { |
496 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); | 496 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); |
497 BookmarkBubbleControllerTest::edits_++; | 497 BookmarkBubbleControllerTest::edits_++; |
498 } | 498 } |
499 | 499 |
500 @end | 500 @end |
OLD | NEW |