| OLD | NEW |
| 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_bubble_controller.h" | 9 #import "chrome/browser/cocoa/bookmark_bubble_controller.h" |
| 10 #include "chrome/browser/cocoa/browser_test_helper.h" | 10 #include "chrome/browser/cocoa/browser_test_helper.h" |
| 11 #include "chrome/browser/cocoa/browser_window_controller.h" | 11 #include "chrome/browser/cocoa/browser_window_controller.h" |
| 12 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 12 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 13 #import "chrome/browser/cocoa/info_bubble_window.h" | 13 #import "chrome/browser/cocoa/info_bubble_window.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class BookmarkBubbleControllerTest : public CocoaTest { | 19 class BookmarkBubbleControllerTest : public CocoaTest { |
| 20 public: | 20 public: |
| 21 static int edits_; | 21 static int edits_; |
| 22 BrowserTestHelper helper_; | 22 BrowserTestHelper helper_; |
| 23 BookmarkBubbleController* controller_; | 23 BookmarkBubbleController* controller_; |
| 24 | 24 |
| 25 BookmarkBubbleControllerTest() : controller_(nil) { | 25 BookmarkBubbleControllerTest() : controller_(nil) { |
| 26 edits_ = 0; | 26 edits_ = 0; |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual void TearDown() { | 29 virtual void TearDown() { |
| 30 // TODO(shess): Figure out why CocoaTest::TearDown() needs 3 | |
| 31 // passes through the event loop to fully close out these windows. | |
| 32 [controller_ close]; | 30 [controller_ close]; |
| 33 CocoaTest::TearDown(); | 31 CocoaTest::TearDown(); |
| 34 } | 32 } |
| 35 | 33 |
| 36 // Returns a controller but ownership not transferred. | 34 // Returns a controller but ownership not transferred. |
| 37 // Only one of these will be valid at a time. | 35 // Only one of these will be valid at a time. |
| 38 BookmarkBubbleController* ControllerForNode(const BookmarkNode* node) { | 36 BookmarkBubbleController* ControllerForNode(const BookmarkNode* node) { |
| 39 if (controller_ && !IsWindowClosing()) { | 37 if (controller_ && !IsWindowClosing()) { |
| 40 [controller_ close]; | 38 [controller_ close]; |
| 41 controller_ = nil; | 39 controller_ = nil; |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // Normally this would be sent up the responder tree correctly, but since | 390 // Normally this would be sent up the responder tree correctly, but since |
| 393 // tests run in the background, key window and main window are never set on | 391 // tests run in the background, key window and main window are never set on |
| 394 // NSApplication. Adding it to NSApplication directly removes the need for | 392 // NSApplication. Adding it to NSApplication directly removes the need for |
| 395 // worrying about what the current window with focus is. | 393 // worrying about what the current window with focus is. |
| 396 - (void)editBookmarkNode:(id)sender { | 394 - (void)editBookmarkNode:(id)sender { |
| 397 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); | 395 EXPECT_TRUE([sender respondsToSelector:@selector(node)]); |
| 398 BookmarkBubbleControllerTest::edits_++; | 396 BookmarkBubbleControllerTest::edits_++; |
| 399 } | 397 } |
| 400 | 398 |
| 401 @end | 399 @end |
| OLD | NEW |