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 3// found in the LICENSE file. 4 5#import <Cocoa/Cocoa.h> 6 7#import "base/memory/scoped_nsobject.h" 8#include "chrome/browser/ui/cocoa/browser_test_helper.h" 9#include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 10#import "chrome/browser/ui/cocoa/hung_renderer_controller.h" 11#include "testing/gtest/include/gtest/gtest.h" 12#include "testing/platform_test.h" 13 14namespace { 15 16class HungRendererControllerTest : public CocoaTest { 17 public: 18 virtual void SetUp() { 19 CocoaTest::SetUp(); 20 hung_renderer_controller_ = [[HungRendererController alloc] 21 initWithWindowNibName:@"HungRendererDialog"]; 22 } 23 HungRendererController* hung_renderer_controller_; // owned by its window 24}; 25 26TEST_F(HungRendererControllerTest, TestShowAndClose) { 27 // Doesn't test much functionality-wise, but makes sure we can 28 // display and tear down a window. 29 [hung_renderer_controller_ showWindow:nil]; 30 // Cannot call performClose:, because the close button is disabled. 31 [hung_renderer_controller_ close]; 32} 33 34TEST_F(HungRendererControllerTest, TestKillButton) { 35 // We can't test killing a process because we have no running 36 // process to kill, but we can make sure that pressing the kill 37 // button closes the window. 38 [hung_renderer_controller_ showWindow:nil]; 39 [[hung_renderer_controller_ killButton] performClick:nil]; 40} 41 42TEST_F(HungRendererControllerTest, TestWaitButton) { 43 // We can't test waiting because we have no running process to wait 44 // for, but we can make sure that pressing the wait button closes 45 // the window. 46 [hung_renderer_controller_ showWindow:nil]; 47 [[hung_renderer_controller_ waitButton] performClick:nil]; 48} 49 50} // namespace 51 52