Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Unified Diff: chrome/browser/ui/cocoa/infobars/infobar_test_helper.mm

Issue 6249010: Cleanup: de-inline a bunch of classes, rename and move "PluginInstaller" to "... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/infobar_test_helper.h ('k') | chrome/browser/ui/cocoa/keystone_infobar.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/infobars/infobar_test_helper.mm
===================================================================
--- chrome/browser/ui/cocoa/infobars/infobar_test_helper.mm (revision 72011)
+++ chrome/browser/ui/cocoa/infobars/infobar_test_helper.mm (working copy)
@@ -1,165 +1,144 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/tab_contents/infobar_delegate.h"
+#include "chrome/browser/ui/cocoa/infobars/infobar_test_helper.h"
#include "base/utf_string_conversions.h"
-namespace {
-const char kMockAlertInfoBarMessage[] = "MockAlertInfoBarMessage";
-const char kMockLinkInfoBarMessage[] = "MockLinkInfoBarMessage";
-const char kMockLinkInfoBarLink[] = "http://dev.chromium.org";
-const char kMockConfirmInfoBarMessage[] = "MockConfirmInfoBarMessage";
+
+// MockAlertInfoBarDelegate ---------------------------------------------------
+
+const char MockAlertInfoBarDelegate::kMessage[] = "MockAlertInfoBarMessage";
+
+MockAlertInfoBarDelegate::MockAlertInfoBarDelegate()
+ : AlertInfoBarDelegate(NULL),
+ icon_accessed_(false),
+ message_text_accessed_(false),
+ closed_(false) {
}
-//////////////////////////////////////////////////////////////////////////
-// Mock InfoBarDelgates
+MockAlertInfoBarDelegate::~MockAlertInfoBarDelegate() {
+}
-class MockAlertInfoBarDelegate : public AlertInfoBarDelegate {
- public:
- explicit MockAlertInfoBarDelegate()
- : AlertInfoBarDelegate(NULL),
- message_text_accessed(false),
- icon_accessed(false),
- closed(false) {
- }
+void MockAlertInfoBarDelegate::InfoBarClosed() {
+ closed_ = true;
+}
- virtual string16 GetMessageText() const {
- message_text_accessed = true;
- return ASCIIToUTF16(kMockAlertInfoBarMessage);
- }
+SkBitmap* MockAlertInfoBarDelegate::GetIcon() const {
+ icon_accessed_ = true;
+ return NULL;
+}
- virtual SkBitmap* GetIcon() const {
- icon_accessed = true;
- return NULL;
- }
+string16 MockAlertInfoBarDelegate::GetMessageText() const {
+ message_text_accessed_ = true;
+ return ASCIIToUTF16(kMessage);
+}
- virtual void InfoBarClosed() {
- closed = true;
- }
- // These are declared mutable to get around const-ness issues.
- mutable bool message_text_accessed;
- mutable bool icon_accessed;
- bool closed;
-};
+// MockLinkInfoBarDelegate ----------------------------------------------------
-class MockLinkInfoBarDelegate : public LinkInfoBarDelegate {
- public:
- explicit MockLinkInfoBarDelegate()
- : LinkInfoBarDelegate(NULL),
- message_text_accessed(false),
- link_text_accessed(false),
- icon_accessed(false),
- link_clicked(false),
- closed(false),
- closes_on_action(true) {
- }
+const char MockLinkInfoBarDelegate::kMessage[] = "MockLinkInfoBarMessage";
+const char MockLinkInfoBarDelegate::kLink[] = "http://dev.chromium.org";
- virtual string16 GetMessageTextWithOffset(size_t* link_offset) const {
- message_text_accessed = true;
- return ASCIIToUTF16(kMockLinkInfoBarMessage);
- }
+MockLinkInfoBarDelegate::MockLinkInfoBarDelegate()
+ : LinkInfoBarDelegate(NULL),
+ closes_on_action_(true),
+ icon_accessed_(false),
+ message_text_accessed_(false),
+ link_text_accessed_(false),
+ link_clicked_(false),
+ closed_(false) {
+}
- virtual string16 GetLinkText() const {
- link_text_accessed = true;
- return ASCIIToUTF16(kMockLinkInfoBarLink);
- }
+MockLinkInfoBarDelegate::~MockLinkInfoBarDelegate() {
+}
- virtual SkBitmap* GetIcon() const {
- icon_accessed = true;
- return NULL;
- }
+void MockLinkInfoBarDelegate::InfoBarClosed() {
+ closed_ = true;
+}
- virtual bool LinkClicked(WindowOpenDisposition disposition) {
- link_clicked = true;
- return closes_on_action;
- }
+SkBitmap* MockLinkInfoBarDelegate::GetIcon() const {
+ icon_accessed_ = true;
+ return NULL;
+}
- virtual void InfoBarClosed() {
- closed = true;
- }
+string16 MockLinkInfoBarDelegate::GetMessageTextWithOffset(
+ size_t* link_offset) const {
+ message_text_accessed_ = true;
+ return ASCIIToUTF16(kMessage);
+}
- // These are declared mutable to get around const-ness issues.
- mutable bool message_text_accessed;
- mutable bool link_text_accessed;
- mutable bool icon_accessed;
- bool link_clicked;
- bool closed;
+string16 MockLinkInfoBarDelegate::GetLinkText() const {
+ link_text_accessed_ = true;
+ return ASCIIToUTF16(kLink);
+}
- // Determines whether the infobar closes when an action is taken or not.
- bool closes_on_action;
-};
+bool MockLinkInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
+ link_clicked_ = true;
+ return closes_on_action_;
+}
-class MockConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
- public:
- explicit MockConfirmInfoBarDelegate()
- : ConfirmInfoBarDelegate(NULL),
- message_text_accessed(false),
- link_text_accessed(false),
- icon_accessed(false),
- ok_clicked(false),
- cancel_clicked(false),
- link_clicked(false),
- closed(false),
- closes_on_action(true) {
- }
- virtual int GetButtons() const {
- return (BUTTON_OK | BUTTON_CANCEL);
- }
+// MockConfirmInfoBarDelegate -------------------------------------------------
- virtual string16 GetButtonLabel(InfoBarButton button) const {
- if (button == BUTTON_OK)
- return ASCIIToUTF16("OK");
- else
- return ASCIIToUTF16("Cancel");
- }
+const char MockConfirmInfoBarDelegate::kMessage[] = "MockConfirmInfoBarMessage";
- virtual bool Accept() {
- ok_clicked = true;
- return closes_on_action;
- }
+MockConfirmInfoBarDelegate::MockConfirmInfoBarDelegate()
+ : ConfirmInfoBarDelegate(NULL),
+ closes_on_action_(true),
+ icon_accessed_(false),
+ message_text_accessed_(false),
+ link_text_accessed_(false),
+ ok_clicked_(false),
+ cancel_clicked_(false),
+ link_clicked_(false),
+ closed_(false) {
+}
- virtual bool Cancel() {
- cancel_clicked = true;
- return closes_on_action;
- }
+MockConfirmInfoBarDelegate::~MockConfirmInfoBarDelegate() {
+}
- virtual string16 GetMessageText() const {
- message_text_accessed = true;
- return ASCIIToUTF16(kMockConfirmInfoBarMessage);
- }
+void MockConfirmInfoBarDelegate::InfoBarClosed() {
+ closed_ = true;
+}
- virtual SkBitmap* GetIcon() const {
- icon_accessed = true;
- return NULL;
- }
+SkBitmap* MockConfirmInfoBarDelegate::GetIcon() const {
+ icon_accessed_ = true;
+ return NULL;
+}
- virtual void InfoBarClosed() {
- closed = true;
- }
+string16 MockConfirmInfoBarDelegate::GetMessageText() const {
+ message_text_accessed_ = true;
+ return ASCIIToUTF16(kMessage);
+}
- virtual string16 GetLinkText() {
- link_text_accessed = true;
- return string16();
- }
+int MockConfirmInfoBarDelegate::GetButtons() const {
+ return BUTTON_OK | BUTTON_CANCEL;
+}
- virtual bool LinkClicked(WindowOpenDisposition disposition) {
- link_clicked = true;
- return closes_on_action;
- }
+string16 MockConfirmInfoBarDelegate::GetButtonLabel(
+ InfoBarButton button) const {
+ return ASCIIToUTF16((button == BUTTON_OK) ? "OK" : "Cancel");
+}
- // These are declared mutable to get around const-ness issues.
- mutable bool message_text_accessed;
- mutable bool link_text_accessed;
- mutable bool icon_accessed;
- bool ok_clicked;
- bool cancel_clicked;
- bool link_clicked;
- bool closed;
+bool MockConfirmInfoBarDelegate::Accept() {
+ ok_clicked_ = true;
+ return closes_on_action_;
+}
- // Determines whether the infobar closes when an action is taken or not.
- bool closes_on_action;
-};
+bool MockConfirmInfoBarDelegate::Cancel() {
+ cancel_clicked_ = true;
+ return closes_on_action_;
+}
+
+string16 MockConfirmInfoBarDelegate::GetLinkText() {
+ link_text_accessed_ = true;
+ return string16();
+}
+
+bool MockConfirmInfoBarDelegate::LinkClicked(
+ WindowOpenDisposition disposition) {
+ link_clicked_ = true;
+ return closes_on_action_;
+}
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/infobar_test_helper.h ('k') | chrome/browser/ui/cocoa/keystone_infobar.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698