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

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

Issue 9030032: Get rid of a bunch of tab_contents.h includes from chrome. These are all trivial changes to use W... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
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"
11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h"
12 #include "chrome/browser/ui/cocoa/browser_window_controller.h" 12 #include "chrome/browser/ui/cocoa/browser_window_controller.h"
13 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 13 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
14 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 14 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
15 #include "content/public/browser/notification_service.h" 15 #include "content/public/browser/notification_service.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #import "testing/gtest_mac.h" 17 #import "testing/gtest_mac.h"
18 #include "testing/platform_test.h" 18 #include "testing/platform_test.h"
19 19
20 using content::WebContents;
21
20 // Watch for bookmark pulse notifications so we can confirm they were sent. 22 // Watch for bookmark pulse notifications so we can confirm they were sent.
21 @interface BookmarkPulseObserver : NSObject { 23 @interface BookmarkPulseObserver : NSObject {
22 int notifications_; 24 int notifications_;
23 } 25 }
24 @property (assign, nonatomic) int notifications; 26 @property (assign, nonatomic) int notifications;
25 @end 27 @end
26 28
27 29
28 @implementation BookmarkPulseObserver 30 @implementation BookmarkPulseObserver
29 31
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 EXPECT_TRUE(controller); 469 EXPECT_TRUE(controller);
468 EXPECT_FALSE(IsWindowClosing()); 470 EXPECT_FALSE(IsWindowClosing());
469 471
470 // We can't actually create a new tab here, e.g. 472 // We can't actually create a new tab here, e.g.
471 // browser()->AddTabWithURL(...); 473 // browser()->AddTabWithURL(...);
472 // Many of our browser objects (Browser, Profile, RequestContext) 474 // Many of our browser objects (Browser, Profile, RequestContext)
473 // are "just enough" to run tests without being complete. Instead 475 // are "just enough" to run tests without being complete. Instead
474 // we fake the notification that would be triggered by a tab 476 // we fake the notification that would be triggered by a tab
475 // creation. See TabContents::NotifyConnected(). 477 // creation. See TabContents::NotifyConnected().
476 content::NotificationService::current()->Notify( 478 content::NotificationService::current()->Notify(
477 content::NOTIFICATION_TAB_CONTENTS_CONNECTED, 479 content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
478 content::Source<TabContents>(NULL), 480 content::Source<WebContents>(NULL),
479 content::NotificationService::NoDetails()); 481 content::NotificationService::NoDetails());
480 482
481 // Confirm bubble going bye-bye. 483 // Confirm bubble going bye-bye.
482 EXPECT_TRUE(IsWindowClosing()); 484 EXPECT_TRUE(IsWindowClosing());
483 } 485 }
484 486
485 487
486 } // namespace 488 } // namespace
487 489
488 @implementation NSApplication (BookmarkBubbleUnitTest) 490 @implementation NSApplication (BookmarkBubbleUnitTest)
489 // Add handler for the editBookmarkNode: action to NSApp for testing purposes. 491 // Add handler for the editBookmarkNode: action to NSApp for testing purposes.
490 // 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
491 // 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
492 // NSApplication. Adding it to NSApplication directly removes the need for 494 // NSApplication. Adding it to NSApplication directly removes the need for
493 // worrying about what the current window with focus is. 495 // worrying about what the current window with focus is.
494 - (void)editBookmarkNode:(id)sender { 496 - (void)editBookmarkNode:(id)sender {
495 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); 497 EXPECT_TRUE([sender respondsToSelector:@selector(node)]);
496 BookmarkBubbleControllerTest::edits_++; 498 BookmarkBubbleControllerTest::edits_++;
497 } 499 }
498 500
499 @end 501 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm ('k') | chrome/browser/ui/sad_tab_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698