1 // Copyright (c) 2012 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 #include "chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.h"
7 #include "base/strings/utf_string_conversions.h"
9 const char MockConfirmInfoBarDelegate::kMessage
[] = "MockConfirmInfoBarMessage";
11 MockConfirmInfoBarDelegate::MockConfirmInfoBarDelegate(Owner
* owner
)
12 : ConfirmInfoBarDelegate(),
14 closes_on_action_(true),
15 icon_accessed_(false),
16 message_text_accessed_(false),
17 link_text_accessed_(false),
19 cancel_clicked_(false),
20 link_clicked_(false) {
23 MockConfirmInfoBarDelegate::~MockConfirmInfoBarDelegate() {
25 owner_
->OnInfoBarDelegateClosed();
28 int MockConfirmInfoBarDelegate::GetIconId() const {
29 icon_accessed_
= true;
33 base::string16
MockConfirmInfoBarDelegate::GetMessageText() const {
34 message_text_accessed_
= true;
35 return base::ASCIIToUTF16(kMessage
);
38 base::string16
MockConfirmInfoBarDelegate::GetButtonLabel(
39 InfoBarButton button
) const {
40 return base::ASCIIToUTF16((button
== BUTTON_OK
) ? "OK" : "Cancel");
43 bool MockConfirmInfoBarDelegate::Accept() {
45 return closes_on_action_
;
48 bool MockConfirmInfoBarDelegate::Cancel() {
49 cancel_clicked_
= true;
50 return closes_on_action_
;
53 base::string16
MockConfirmInfoBarDelegate::GetLinkText() const {
54 link_text_accessed_
= true;
55 return base::string16();
58 bool MockConfirmInfoBarDelegate::LinkClicked(
59 WindowOpenDisposition disposition
) {
61 return closes_on_action_
;