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

Side by Side Diff: chrome/browser/ui/cocoa/hung_renderer_controller_unittest.mm

Issue 8351038: [Mac] Stop listening for NSWindowWillCloseNotification in |-dealloc| to fix a crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/cocoa/browser/avatar_button_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "base/memory/scoped_nsobject.h" 7 #import "base/memory/scoped_nsobject.h"
8 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 8 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
9 #import "chrome/browser/ui/cocoa/hung_renderer_controller.h" 9 #import "chrome/browser/ui/cocoa/hung_renderer_controller.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h" 11 #include "testing/platform_test.h"
12 12
13 namespace { 13 namespace {
14 14
15 class HungRendererControllerTest : public CocoaTest { 15 class HungRendererControllerTest : public CocoaTest {
16 public: 16 public:
17 virtual void SetUp() { 17 virtual void SetUp() {
18 CocoaTest::SetUp(); 18 CocoaTest::SetUp();
19 hung_renderer_controller_ = [[HungRendererController alloc] 19 hung_renderer_controller_ = [[HungRendererController alloc]
20 initWithWindowNibName:@"HungRendererDialog"]; 20 initWithWindowNibName:@"HungRendererDialog"];
21 } 21 }
22 HungRendererController* hung_renderer_controller_; // owned by its window 22 HungRendererController* hung_renderer_controller_; // owned by its window
23 }; 23 };
24 24
25 TEST_F(HungRendererControllerTest, FLAKY_TestShowAndClose) { 25 TEST_F(HungRendererControllerTest, TestShowAndClose) {
26 // Doesn't test much functionality-wise, but makes sure we can 26 // Doesn't test much functionality-wise, but makes sure we can
27 // display and tear down a window. 27 // display and tear down a window.
28 [hung_renderer_controller_ showWindow:nil]; 28 [hung_renderer_controller_ showWindow:nil];
29 // Cannot call performClose:, because the close button is disabled. 29 // Cannot call performClose:, because the close button is disabled.
30 [hung_renderer_controller_ close]; 30 [hung_renderer_controller_ close];
31 } 31 }
32 32
33 TEST_F(HungRendererControllerTest, TestKillButton) { 33 TEST_F(HungRendererControllerTest, TestKillButton) {
34 // We can't test killing a process because we have no running 34 // We can't test killing a process because we have no running
35 // process to kill, but we can make sure that pressing the kill 35 // process to kill, but we can make sure that pressing the kill
36 // button closes the window. 36 // button closes the window.
37 [hung_renderer_controller_ showWindow:nil]; 37 [hung_renderer_controller_ showWindow:nil];
38 [[hung_renderer_controller_ killButton] performClick:nil]; 38 [[hung_renderer_controller_ killButton] performClick:nil];
39 } 39 }
40 40
41 TEST_F(HungRendererControllerTest, TestWaitButton) { 41 TEST_F(HungRendererControllerTest, TestWaitButton) {
42 // We can't test waiting because we have no running process to wait 42 // We can't test waiting because we have no running process to wait
43 // for, but we can make sure that pressing the wait button closes 43 // for, but we can make sure that pressing the wait button closes
44 // the window. 44 // the window.
45 [hung_renderer_controller_ showWindow:nil]; 45 [hung_renderer_controller_ showWindow:nil];
46 [[hung_renderer_controller_ waitButton] performClick:nil]; 46 [[hung_renderer_controller_ waitButton] performClick:nil];
47 } 47 }
48 48
49 } // namespace 49 } // namespace
50 50
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser/avatar_button_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698