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 #include "chrome/browser/ui/cocoa/infobars/infobar_test_helper.h" | 5 #include "chrome/browser/ui/cocoa/infobars/infobar_test_helper.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 | 8 |
9 | 9 |
10 // MockLinkInfoBarDelegate ---------------------------------------------------- | 10 // MockLinkInfoBarDelegate ---------------------------------------------------- |
11 | 11 |
12 const char MockLinkInfoBarDelegate::kMessage[] = "MockLinkInfoBarMessage"; | 12 const char MockLinkInfoBarDelegate::kMessage[] = "MockLinkInfoBarMessage "; |
13 const char MockLinkInfoBarDelegate::kLink[] = "http://dev.chromium.org"; | 13 const char MockLinkInfoBarDelegate::kLink[] = "http://dev.chromium.org"; |
14 | 14 |
15 MockLinkInfoBarDelegate::MockLinkInfoBarDelegate() | 15 MockLinkInfoBarDelegate::MockLinkInfoBarDelegate() |
16 : LinkInfoBarDelegate(NULL), | 16 : LinkInfoBarDelegate(NULL), |
17 closes_on_action_(true), | 17 closes_on_action_(true), |
18 icon_accessed_(false), | 18 icon_accessed_(false), |
19 message_text_accessed_(false), | 19 message_text_accessed_(false), |
20 link_text_accessed_(false), | 20 link_text_accessed_(false), |
21 link_clicked_(false), | 21 link_clicked_(false), |
22 closed_(false) { | 22 closed_(false) { |
23 } | 23 } |
24 | 24 |
25 MockLinkInfoBarDelegate::~MockLinkInfoBarDelegate() { | 25 MockLinkInfoBarDelegate::~MockLinkInfoBarDelegate() { |
26 } | 26 } |
27 | 27 |
28 void MockLinkInfoBarDelegate::InfoBarClosed() { | 28 void MockLinkInfoBarDelegate::InfoBarClosed() { |
29 closed_ = true; | 29 closed_ = true; |
30 } | 30 } |
31 | 31 |
32 SkBitmap* MockLinkInfoBarDelegate::GetIcon() const { | 32 SkBitmap* MockLinkInfoBarDelegate::GetIcon() const { |
33 icon_accessed_ = true; | 33 icon_accessed_ = true; |
34 return NULL; | 34 return NULL; |
35 } | 35 } |
36 | 36 |
37 string16 MockLinkInfoBarDelegate::GetMessageTextWithOffset( | 37 string16 MockLinkInfoBarDelegate::GetMessageTextWithOffset( |
38 size_t* link_offset) const { | 38 size_t* link_offset) const { |
39 message_text_accessed_ = true; | 39 message_text_accessed_ = true; |
| 40 *link_offset = arraysize(kMessage) - 1; |
40 return ASCIIToUTF16(kMessage); | 41 return ASCIIToUTF16(kMessage); |
41 } | 42 } |
42 | 43 |
43 string16 MockLinkInfoBarDelegate::GetLinkText() const { | 44 string16 MockLinkInfoBarDelegate::GetLinkText() const { |
44 link_text_accessed_ = true; | 45 link_text_accessed_ = true; |
45 return ASCIIToUTF16(kLink); | 46 return ASCIIToUTF16(kLink); |
46 } | 47 } |
47 | 48 |
48 bool MockLinkInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 49 bool MockLinkInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
49 link_clicked_ = true; | 50 link_clicked_ = true; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 string16 MockConfirmInfoBarDelegate::GetLinkText() { | 103 string16 MockConfirmInfoBarDelegate::GetLinkText() { |
103 link_text_accessed_ = true; | 104 link_text_accessed_ = true; |
104 return string16(); | 105 return string16(); |
105 } | 106 } |
106 | 107 |
107 bool MockConfirmInfoBarDelegate::LinkClicked( | 108 bool MockConfirmInfoBarDelegate::LinkClicked( |
108 WindowOpenDisposition disposition) { | 109 WindowOpenDisposition disposition) { |
109 link_clicked_ = true; | 110 link_clicked_ = true; |
110 return closes_on_action_; | 111 return closes_on_action_; |
111 } | 112 } |
OLD | NEW |