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

Unified Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller_unittest.mm

Issue 1221173003: [Mac] Inform reference counted objects that hold a weak Browser* when the Browser is being destroye… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep -[BookmarBarController dealloc] instead of changing all the tests. Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/toolbar/toolbar_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller_unittest.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller_unittest.mm
index 0edcb6a60832735866136104fdd05ff429e1a976..1eeffaed319c00f982ce2e01dc2f6f1a1b578789 100644
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller_unittest.mm
@@ -17,7 +17,6 @@
#include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
#import "chrome/browser/ui/cocoa/image_button_cell.h"
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
-#import "chrome/browser/ui/cocoa/view_resizer_pong.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -85,12 +84,10 @@ class ToolbarControllerTest : public CocoaProfileTest {
// ensure they get picked up correct on initialization
updater->UpdateCommandEnabled(IDC_BACK, false);
updater->UpdateCommandEnabled(IDC_FORWARD, false);
- resizeDelegate_.reset([[ViewResizerPong alloc] init]);
bar_.reset([[TestToolbarController alloc]
initWithCommands:browser()->command_controller()->command_updater()
profile:profile()
- browser:browser()
- resizeDelegate:resizeDelegate_.get()]);
+ browser:browser()]);
EXPECT_TRUE([bar_ view]);
NSView* parent = [test_window() contentView];
[parent addSubview:[bar_ view]];
@@ -114,7 +111,6 @@ class ToolbarControllerTest : public CocoaProfileTest {
[[views objectAtIndex:kHomeIndex] isEnabled] ? true : false);
}
- base::scoped_nsobject<ViewResizerPong> resizeDelegate_;
base::scoped_nsobject<TestToolbarController> bar_;
};
@@ -298,9 +294,11 @@ class BrowserRemovedObserver : public chrome::BrowserListObserver {
// This can happen because the ToolbarController is retained by both the
// BrowserWindowController and -[ToolbarController view], the latter of which is
// autoreleased.
-// TODO(nhiroki): This is disabled due to http://crbug.com/506745.
-TEST_F(ToolbarControllerTest, DISABLED_ToolbarDestroyedAfterBrowser) {
+TEST_F(ToolbarControllerTest, ToolbarDestroyedAfterBrowser) {
BrowserRemovedObserver observer;
+ // This is normally called by BrowserWindowController, but since |bar_| is not
+ // owned by one, call it here.
+ [bar_ browserWillBeDestroyed];
CloseBrowserWindow();
observer.WaitUntilBrowserRemoved();
// |bar_| is released in TearDown().

Powered by Google App Engine
This is Rietveld 408576698