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