| 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 // MockAlertInfoBarDelegate --------------------------------------------------- | |
| 11 | |
| 12 const char MockAlertInfoBarDelegate::kMessage[] = "MockAlertInfoBarMessage"; | |
| 13 | |
| 14 MockAlertInfoBarDelegate::MockAlertInfoBarDelegate() | |
| 15 : AlertInfoBarDelegate(NULL), | |
| 16 icon_accessed_(false), | |
| 17 message_text_accessed_(false), | |
| 18 closed_(false) { | |
| 19 } | |
| 20 | |
| 21 MockAlertInfoBarDelegate::~MockAlertInfoBarDelegate() { | |
| 22 } | |
| 23 | |
| 24 void MockAlertInfoBarDelegate::InfoBarClosed() { | |
| 25 closed_ = true; | |
| 26 } | |
| 27 | |
| 28 SkBitmap* MockAlertInfoBarDelegate::GetIcon() const { | |
| 29 icon_accessed_ = true; | |
| 30 return NULL; | |
| 31 } | |
| 32 | |
| 33 string16 MockAlertInfoBarDelegate::GetMessageText() const { | |
| 34 message_text_accessed_ = true; | |
| 35 return ASCIIToUTF16(kMessage); | |
| 36 } | |
| 37 | |
| 38 | |
| 39 // MockLinkInfoBarDelegate ---------------------------------------------------- | 10 // MockLinkInfoBarDelegate ---------------------------------------------------- |
| 40 | 11 |
| 41 const char MockLinkInfoBarDelegate::kMessage[] = "MockLinkInfoBarMessage"; | 12 const char MockLinkInfoBarDelegate::kMessage[] = "MockLinkInfoBarMessage"; |
| 42 const char MockLinkInfoBarDelegate::kLink[] = "http://dev.chromium.org"; | 13 const char MockLinkInfoBarDelegate::kLink[] = "http://dev.chromium.org"; |
| 43 | 14 |
| 44 MockLinkInfoBarDelegate::MockLinkInfoBarDelegate() | 15 MockLinkInfoBarDelegate::MockLinkInfoBarDelegate() |
| 45 : LinkInfoBarDelegate(NULL), | 16 : LinkInfoBarDelegate(NULL), |
| 46 closes_on_action_(true), | 17 closes_on_action_(true), |
| 47 icon_accessed_(false), | 18 icon_accessed_(false), |
| 48 message_text_accessed_(false), | 19 message_text_accessed_(false), |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 SkBitmap* MockConfirmInfoBarDelegate::GetIcon() const { | 77 SkBitmap* MockConfirmInfoBarDelegate::GetIcon() const { |
| 107 icon_accessed_ = true; | 78 icon_accessed_ = true; |
| 108 return NULL; | 79 return NULL; |
| 109 } | 80 } |
| 110 | 81 |
| 111 string16 MockConfirmInfoBarDelegate::GetMessageText() const { | 82 string16 MockConfirmInfoBarDelegate::GetMessageText() const { |
| 112 message_text_accessed_ = true; | 83 message_text_accessed_ = true; |
| 113 return ASCIIToUTF16(kMessage); | 84 return ASCIIToUTF16(kMessage); |
| 114 } | 85 } |
| 115 | 86 |
| 116 int MockConfirmInfoBarDelegate::GetButtons() const { | |
| 117 return BUTTON_OK | BUTTON_CANCEL; | |
| 118 } | |
| 119 | |
| 120 string16 MockConfirmInfoBarDelegate::GetButtonLabel( | 87 string16 MockConfirmInfoBarDelegate::GetButtonLabel( |
| 121 InfoBarButton button) const { | 88 InfoBarButton button) const { |
| 122 return ASCIIToUTF16((button == BUTTON_OK) ? "OK" : "Cancel"); | 89 return ASCIIToUTF16((button == BUTTON_OK) ? "OK" : "Cancel"); |
| 123 } | 90 } |
| 124 | 91 |
| 125 bool MockConfirmInfoBarDelegate::Accept() { | 92 bool MockConfirmInfoBarDelegate::Accept() { |
| 126 ok_clicked_ = true; | 93 ok_clicked_ = true; |
| 127 return closes_on_action_; | 94 return closes_on_action_; |
| 128 } | 95 } |
| 129 | 96 |
| 130 bool MockConfirmInfoBarDelegate::Cancel() { | 97 bool MockConfirmInfoBarDelegate::Cancel() { |
| 131 cancel_clicked_ = true; | 98 cancel_clicked_ = true; |
| 132 return closes_on_action_; | 99 return closes_on_action_; |
| 133 } | 100 } |
| 134 | 101 |
| 135 string16 MockConfirmInfoBarDelegate::GetLinkText() { | 102 string16 MockConfirmInfoBarDelegate::GetLinkText() { |
| 136 link_text_accessed_ = true; | 103 link_text_accessed_ = true; |
| 137 return string16(); | 104 return string16(); |
| 138 } | 105 } |
| 139 | 106 |
| 140 bool MockConfirmInfoBarDelegate::LinkClicked( | 107 bool MockConfirmInfoBarDelegate::LinkClicked( |
| 141 WindowOpenDisposition disposition) { | 108 WindowOpenDisposition disposition) { |
| 142 link_clicked_ = true; | 109 link_clicked_ = true; |
| 143 return closes_on_action_; | 110 return closes_on_action_; |
| 144 } | 111 } |
| OLD | NEW |