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