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