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