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 #ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_CONFIRM_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_CONFIRM_INFOBAR_DELEGATE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/strings/string16.h"
11 #include "components/infobars/core/confirm_infobar_delegate.h"
13 class MockConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
15 // Called when |this| is about to be destroyed.
18 virtual void OnInfoBarDelegateClosed() = 0;
24 explicit MockConfirmInfoBarDelegate(Owner* owner);
25 ~MockConfirmInfoBarDelegate() override;
27 void set_dont_close_on_action() { closes_on_action_ = false; }
28 bool icon_accessed() const { return icon_accessed_; }
29 bool message_text_accessed() const { return message_text_accessed_; }
30 bool link_text_accessed() const { return link_text_accessed_; }
31 bool ok_clicked() const { return ok_clicked_; }
32 bool cancel_clicked() const { return cancel_clicked_; }
33 bool link_clicked() const { return link_clicked_; }
35 static const char kMessage[];
38 // ConfirmInfoBarDelegate:
39 int GetIconID() const override;
40 base::string16 GetMessageText() const override;
41 base::string16 GetButtonLabel(InfoBarButton button) const override;
42 bool Accept() override;
43 bool Cancel() override;
44 base::string16 GetLinkText() const override;
45 bool LinkClicked(WindowOpenDisposition disposition) override;
48 // Determines whether the infobar closes when an action is taken or not.
49 bool closes_on_action_;
50 mutable bool icon_accessed_;
51 mutable bool message_text_accessed_;
52 mutable bool link_text_accessed_;
57 DISALLOW_COPY_AND_ASSIGN(MockConfirmInfoBarDelegate);
60 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_CONFIRM_INFOBAR_DELEGATE_H_