1 // Copyright 2012 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_TOOLBAR_TEST_TOOLBAR_MODEL_H_ 6 #define CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_H_ 7 8 #include "base/compiler_specific.h" 9 #include "base/strings/string16.h" 10 #include "chrome/browser/ui/toolbar/toolbar_model.h" 11 12 // A ToolbarModel that is backed by instance variables, which are initialized 13 // with some basic values that can be changed with the provided setters. This 14 // should be used only for testing. 15 class TestToolbarModel : public ToolbarModel { 16 public: 17 TestToolbarModel(); 18 virtual ~TestToolbarModel(); 19 virtual base::string16 GetText() const OVERRIDE; 20 virtual base::string16 GetCorpusNameForMobile() const OVERRIDE; 21 virtual GURL GetURL() const OVERRIDE; 22 virtual bool WouldPerformSearchTermReplacement( 23 bool ignore_editing) const OVERRIDE; 24 virtual SecurityLevel GetSecurityLevel(bool ignore_editing) const OVERRIDE; 25 virtual int GetIcon() const OVERRIDE; 26 virtual int GetIconForSecurityLevel(SecurityLevel level) const OVERRIDE; 27 virtual base::string16 GetEVCertName() const OVERRIDE; 28 virtual bool ShouldDisplayURL() const OVERRIDE; 29 30 void set_text(const base::string16& text) { text_ = text; } 31 void set_url(const GURL& url) { url_ = url;} 32 void set_omit_url_due_to_origin_chip(bool omit_url_due_to_origin_chip) { 33 omit_url_due_to_origin_chip_ = omit_url_due_to_origin_chip; 34 } 35 void set_perform_search_term_replacement( 36 bool perform_search_term_replacement) { 37 perform_search_term_replacement_ = perform_search_term_replacement; 38 } 39 void set_security_level(SecurityLevel security_level) { 40 security_level_ = security_level; 41 } 42 void set_icon(int icon) { icon_ = icon; } 43 void set_ev_cert_name(const base::string16& ev_cert_name) { 44 ev_cert_name_ = ev_cert_name; 45 } 46 void set_should_display_url(bool should_display_url) { 47 should_display_url_ = should_display_url; 48 } 49 50 private: 51 virtual bool WouldOmitURLDueToOriginChip() const OVERRIDE; 52 53 base::string16 text_; 54 GURL url_; 55 bool omit_url_due_to_origin_chip_; 56 bool perform_search_term_replacement_; 57 SecurityLevel security_level_; 58 int icon_; 59 base::string16 ev_cert_name_; 60 bool should_display_url_; 61 62 DISALLOW_COPY_AND_ASSIGN(TestToolbarModel); 63 }; 64 65 #endif // CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_H_ 66