Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / hung_renderer_controller_unittest.mm
blob4a5cc77c709d1ef3046cc040153c3f4442f76947
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.
5 #import <Cocoa/Cocoa.h>
7 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
8 #import "chrome/browser/ui/cocoa/hung_renderer_controller.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/platform_test.h"
12 namespace {
14 class HungRendererControllerTest : public CocoaTest {
15  public:
16   void SetUp() override {
17     CocoaTest::SetUp();
18     hung_renderer_controller_ = [[HungRendererController alloc]
19                                   initWithWindowNibName:@"HungRendererDialog"];
20   }
21   HungRendererController* hung_renderer_controller_;  // owned by its window
24 TEST_F(HungRendererControllerTest, TestShowAndClose) {
25   // Doesn't test much functionality-wise, but makes sure we can
26   // display and tear down a window.
27   [hung_renderer_controller_ showWindow:nil];
28   // Cannot call performClose:, because the close button is disabled.
29   [hung_renderer_controller_ close];
32 TEST_F(HungRendererControllerTest, TestKillButton) {
33   // We can't test killing a process because we have no running
34   // process to kill, but we can make sure that pressing the kill
35   // button closes the window.
36   [hung_renderer_controller_ showWindow:nil];
37   [[hung_renderer_controller_ killButton] performClick:nil];
40 TEST_F(HungRendererControllerTest, TestWaitButton) {
41   // We can't test waiting because we have no running process to wait
42   // for, but we can make sure that pressing the wait button closes
43   // the window.
44   [hung_renderer_controller_ showWindow:nil];
45   [[hung_renderer_controller_ waitButton] performClick:nil];
48 }  // namespace