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 IOS_CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_IOS_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_IOS_H_ |
6 #define IOS_CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_IOS_H_ | 6 #define IOS_CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_IOS_H_ |
7 | 7 |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
13 #include "components/toolbar/test_toolbar_model.h" | 13 #include "components/toolbar/test_toolbar_model.h" |
14 #include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" | 14 #include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" |
15 | 15 |
16 class TestToolbarModelIOS : public ToolbarModelIOS { | 16 class TestToolbarModelIOS : public ToolbarModelIOS { |
17 public: | 17 public: |
18 TestToolbarModelIOS(); | 18 TestToolbarModelIOS(); |
19 ~TestToolbarModelIOS() override; | 19 ~TestToolbarModelIOS() override; |
20 | 20 |
| 21 // Getter to the TestToolbarModel to set its values in tests. |
| 22 TestToolbarModel* GetToolbarModel(); |
| 23 |
21 // ToolbarModelIOS implementation: | 24 // ToolbarModelIOS implementation: |
22 ToolbarModel* GetToolbarModel() override; | |
23 bool IsLoading() override; | 25 bool IsLoading() override; |
24 CGFloat GetLoadProgressFraction() override; | 26 CGFloat GetLoadProgressFraction() override; |
25 bool CanGoBack() override; | 27 bool CanGoBack() override; |
26 bool CanGoForward() override; | 28 bool CanGoForward() override; |
27 bool IsCurrentTabNativePage() override; | 29 bool IsCurrentTabNativePage() override; |
28 bool IsCurrentTabBookmarked() override; | 30 bool IsCurrentTabBookmarked() override; |
29 bool IsCurrentTabBookmarkedByUser() override; | 31 bool IsCurrentTabBookmarkedByUser() override; |
30 bool ShouldDisplayHintText() override; | 32 bool ShouldDisplayHintText() override; |
31 | 33 |
| 34 base::string16 GetFormattedURL(size_t* prefix_end) const override; |
| 35 GURL GetURL() const override; |
| 36 security_state::SecurityLevel GetSecurityLevel( |
| 37 bool ignore_editing) const override; |
| 38 gfx::VectorIconId GetVectorIcon() const override; |
| 39 base::string16 GetSecureVerboseText() const override; |
| 40 base::string16 GetEVCertName() const override; |
| 41 bool ShouldDisplayURL() const override; |
| 42 |
32 void set_is_loading(bool is_loading) { is_loading_ = is_loading; } | 43 void set_is_loading(bool is_loading) { is_loading_ = is_loading; } |
33 void set_load_progress_fraction(CGFloat load_progress_fraction) { | 44 void set_load_progress_fraction(CGFloat load_progress_fraction) { |
34 load_progress_fraction_ = load_progress_fraction; | 45 load_progress_fraction_ = load_progress_fraction; |
35 } | 46 } |
36 void set_can_go_back(bool can_go_back) { can_go_back_ = can_go_back; } | 47 void set_can_go_back(bool can_go_back) { can_go_back_ = can_go_back; } |
37 void set_can_go_forward(bool can_go_forward) { | 48 void set_can_go_forward(bool can_go_forward) { |
38 can_go_forward_ = can_go_forward; | 49 can_go_forward_ = can_go_forward; |
39 } | 50 } |
40 void set_is_current_tab_native_page(bool is_current_tab_native_page) { | 51 void set_is_current_tab_native_page(bool is_current_tab_native_page) { |
41 is_current_tab_native_page_ = is_current_tab_native_page; | 52 is_current_tab_native_page_ = is_current_tab_native_page; |
42 } | 53 } |
43 void set_is_current_tab_bookmarked(bool is_current_tab_bookmarked) { | 54 void set_is_current_tab_bookmarked(bool is_current_tab_bookmarked) { |
44 is_current_tab_bookmarked_ = is_current_tab_bookmarked; | 55 is_current_tab_bookmarked_ = is_current_tab_bookmarked; |
45 } | 56 } |
46 | 57 |
47 private: | 58 private: |
48 std::unique_ptr<TestToolbarModel> test_toolbar_model_; | 59 std::unique_ptr<TestToolbarModel> test_toolbar_model_; |
49 bool is_loading_; | 60 bool is_loading_; |
50 CGFloat load_progress_fraction_; | 61 CGFloat load_progress_fraction_; |
51 bool can_go_back_; | 62 bool can_go_back_; |
52 bool can_go_forward_; | 63 bool can_go_forward_; |
53 bool is_current_tab_native_page_; | 64 bool is_current_tab_native_page_; |
54 bool is_current_tab_bookmarked_; | 65 bool is_current_tab_bookmarked_; |
55 }; | 66 }; |
56 | 67 |
57 #endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_IOS_H_ | 68 #endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TEST_TOOLBAR_MODEL_IOS_H_ |
OLD | NEW |