summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/tab_modal_confirm_dialog_browsertest_mac.mm
blob: f96240a02ed6161b539ef8a078bf7d6037803ebc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h"

#include "chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h"
#include "testing/gtest/include/gtest/gtest.h"

TabModalConfirmDialog* TabModalConfirmDialogTest::CreateTestDialog(
    TabModalConfirmDialogDelegate* delegate, TabContents* tab_contents) {
  return new TabModalConfirmDialogMac(delegate, tab_contents);
}

void TabModalConfirmDialogTest::CloseDialog(bool accept) {
  NSWindow* window = [(NSAlert*)dialog_->sheet() window];
  ASSERT_TRUE(window);
  ASSERT_TRUE(dialog_->is_sheet_open());
  [NSApp endSheet:window
       returnCode:accept ? NSAlertFirstButtonReturn :
                           NSAlertSecondButtonReturn];
}