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. 4 5 #ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_LINK_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_LINK_INFOBAR_DELEGATE_H_ 7 #pragma once 8 9 #include "base/basictypes.h" 10 #include "base/compiler_specific.h" 11 #include "base/string16.h" 12 #include "chrome/browser/tab_contents/link_infobar_delegate.h" 13 14 class SkBitmap; 15 16 class MockLinkInfoBarDelegate : public LinkInfoBarDelegate { 17 public: 18 MockLinkInfoBarDelegate(); 19 virtual ~MockLinkInfoBarDelegate(); 20 set_dont_close_on_action()21 void set_dont_close_on_action() { closes_on_action_ = false; } icon_accessed()22 bool icon_accessed() const { return icon_accessed_; } message_text_accessed()23 bool message_text_accessed() const { return message_text_accessed_; } link_text_accessed()24 bool link_text_accessed() const { return link_text_accessed_; } link_clicked()25 bool link_clicked() const { return link_clicked_; } closed()26 bool closed() const { return closed_; } 27 28 static const char kMessage[]; 29 static const char kLink[]; 30 31 private: 32 // LinkInfoBarDelegate: 33 virtual void InfoBarClosed() OVERRIDE; 34 virtual SkBitmap* GetIcon() const OVERRIDE; 35 virtual string16 GetMessageTextWithOffset(size_t* link_offset) const OVERRIDE; 36 virtual string16 GetLinkText() const OVERRIDE; 37 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; 38 39 // Determines whether the infobar closes when an action is taken or not. 40 bool closes_on_action_; 41 mutable bool icon_accessed_; 42 mutable bool message_text_accessed_; 43 mutable bool link_text_accessed_; 44 bool link_clicked_; 45 bool closed_; 46 47 DISALLOW_COPY_AND_ASSIGN(MockLinkInfoBarDelegate); 48 }; 49 50 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_MOCK_LINK_INFOBAR_DELEGATE_H_ 51