OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_TEST_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_TEST_HELPER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_TEST_HELPER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_TEST_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/tab_contents/infobar_delegate.h" | 9 #include "chrome/browser/tab_contents/infobar_delegate.h" |
10 | 10 |
11 | 11 |
12 // MockAlertInfoBarDelegate --------------------------------------------------- | |
13 | |
14 class MockAlertInfoBarDelegate : public AlertInfoBarDelegate { | |
15 public: | |
16 MockAlertInfoBarDelegate(); | |
17 virtual ~MockAlertInfoBarDelegate(); | |
18 | |
19 bool icon_accessed() const { return icon_accessed_; } | |
20 bool message_text_accessed() const { return message_text_accessed_; } | |
21 bool closed() const { return closed_; } | |
22 | |
23 static const char kMessage[]; | |
24 | |
25 private: | |
26 // AlertInfoBarDelegate | |
27 virtual void InfoBarClosed(); | |
28 virtual SkBitmap* GetIcon() const; | |
29 virtual string16 GetMessageText() const; | |
30 | |
31 mutable bool icon_accessed_; | |
32 mutable bool message_text_accessed_; | |
33 bool closed_; | |
34 | |
35 DISALLOW_COPY_AND_ASSIGN(MockAlertInfoBarDelegate); | |
36 }; | |
37 | |
38 | |
39 // MockLinkInfoBarDelegate ---------------------------------------------------- | 12 // MockLinkInfoBarDelegate ---------------------------------------------------- |
40 | 13 |
41 class MockLinkInfoBarDelegate : public LinkInfoBarDelegate { | 14 class MockLinkInfoBarDelegate : public LinkInfoBarDelegate { |
42 public: | 15 public: |
43 MockLinkInfoBarDelegate(); | 16 MockLinkInfoBarDelegate(); |
44 virtual ~MockLinkInfoBarDelegate(); | 17 virtual ~MockLinkInfoBarDelegate(); |
45 | 18 |
46 void set_dont_close_on_action() { closes_on_action_ = false; } | 19 void set_dont_close_on_action() { closes_on_action_ = false; } |
47 | 20 |
48 bool icon_accessed() const { return icon_accessed_; } | 21 bool icon_accessed() const { return icon_accessed_; } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 bool link_clicked() const { return link_clicked_; } | 65 bool link_clicked() const { return link_clicked_; } |
93 bool closed() const { return closed_; } | 66 bool closed() const { return closed_; } |
94 | 67 |
95 static const char kMessage[]; | 68 static const char kMessage[]; |
96 | 69 |
97 private: | 70 private: |
98 // ConfirmInfoBarDelegate | 71 // ConfirmInfoBarDelegate |
99 virtual void InfoBarClosed(); | 72 virtual void InfoBarClosed(); |
100 virtual SkBitmap* GetIcon() const; | 73 virtual SkBitmap* GetIcon() const; |
101 virtual string16 GetMessageText() const; | 74 virtual string16 GetMessageText() const; |
102 virtual int GetButtons() const; | |
103 virtual string16 GetButtonLabel(InfoBarButton button) const; | 75 virtual string16 GetButtonLabel(InfoBarButton button) const; |
104 virtual bool Accept(); | 76 virtual bool Accept(); |
105 virtual bool Cancel(); | 77 virtual bool Cancel(); |
106 virtual string16 GetLinkText(); | 78 virtual string16 GetLinkText(); |
107 virtual bool LinkClicked(WindowOpenDisposition disposition); | 79 virtual bool LinkClicked(WindowOpenDisposition disposition); |
108 | 80 |
109 // Determines whether the infobar closes when an action is taken or not. | 81 // Determines whether the infobar closes when an action is taken or not. |
110 bool closes_on_action_; | 82 bool closes_on_action_; |
111 | 83 |
112 mutable bool icon_accessed_; | 84 mutable bool icon_accessed_; |
113 mutable bool message_text_accessed_; | 85 mutable bool message_text_accessed_; |
114 mutable bool link_text_accessed_; | 86 mutable bool link_text_accessed_; |
115 bool ok_clicked_; | 87 bool ok_clicked_; |
116 bool cancel_clicked_; | 88 bool cancel_clicked_; |
117 bool link_clicked_; | 89 bool link_clicked_; |
118 bool closed_; | 90 bool closed_; |
119 | 91 |
120 DISALLOW_COPY_AND_ASSIGN(MockConfirmInfoBarDelegate); | 92 DISALLOW_COPY_AND_ASSIGN(MockConfirmInfoBarDelegate); |
121 }; | 93 }; |
122 | 94 |
123 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_TEST_HELPER_H_ | 95 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_TEST_HELPER_H_ |
OLD | NEW |