OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ | 5 #ifndef IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ |
6 #define IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ | 6 #define IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "ios/web/public/web_state/url_verification_constants.h" |
10 #include "ios/web/public/web_state/web_state.h" | 11 #include "ios/web/public/web_state/web_state.h" |
11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
12 | 13 |
13 namespace web { | 14 namespace web { |
14 | 15 |
15 // Minimal implementation of WebState, to be used in tests. | 16 // Minimal implementation of WebState, to be used in tests. |
16 class TestWebState : public WebState { | 17 class TestWebState : public WebState { |
17 public: | 18 public: |
| 19 TestWebState(); |
| 20 ~TestWebState() override; |
| 21 |
18 // WebState implementation. | 22 // WebState implementation. |
| 23 UIView* GetView() override; |
| 24 WebViewType GetWebViewType() const override; |
19 BrowserState* GetBrowserState() const override; | 25 BrowserState* GetBrowserState() const override; |
20 void OpenURL(const OpenURLParams& params) override {} | 26 void OpenURL(const OpenURLParams& params) override {} |
21 NavigationManager* GetNavigationManager() override; | 27 NavigationManager* GetNavigationManager() override; |
22 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; | 28 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; |
23 const std::string& GetContentsMimeType() const override; | 29 const std::string& GetContentsMimeType() const override; |
24 const std::string& GetContentLanguageHeader() const override; | 30 const std::string& GetContentLanguageHeader() const override; |
25 bool ContentIsHTML() const override; | 31 bool ContentIsHTML() const override; |
26 const GURL& GetVisibleURL() const override; | 32 const GURL& GetVisibleURL() const override; |
27 const GURL& GetLastCommittedURL() const override; | 33 const GURL& GetLastCommittedURL() const override; |
| 34 GURL GetCurrentURL(URLVerificationTrustLevel* trust_level) const override; |
28 void AddScriptCommandCallback(const ScriptCommandCallback& callback, | 35 void AddScriptCommandCallback(const ScriptCommandCallback& callback, |
29 const std::string& command_prefix) override {} | 36 const std::string& command_prefix) override {} |
30 void RemoveScriptCommandCallback(const std::string& command_prefix) override { | 37 void RemoveScriptCommandCallback(const std::string& command_prefix) override { |
31 } | 38 } |
| 39 CRWWebViewProxyType GetWebViewProxy() const override; |
| 40 bool IsShowingWebInterstitial() const override; |
| 41 WebInterstitial* GetWebInterstitial() const override; |
32 void AddObserver(WebStateObserver* observer) override {} | 42 void AddObserver(WebStateObserver* observer) override {} |
33 void RemoveObserver(WebStateObserver* observer) override {} | 43 void RemoveObserver(WebStateObserver* observer) override {} |
34 | 44 |
| 45 // Setters for test data. |
| 46 void SetContentIsHTML(bool content_is_html); |
| 47 void SetCurrentURL(const GURL& url); |
| 48 void SetTrustLevel(URLVerificationTrustLevel trust_level); |
| 49 |
35 private: | 50 private: |
36 GURL url_; | 51 GURL url_; |
| 52 URLVerificationTrustLevel trust_level_; |
| 53 bool content_is_html_; |
37 std::string mime_type_; | 54 std::string mime_type_; |
38 std::string content_language_; | 55 std::string content_language_; |
39 }; | 56 }; |
40 | 57 |
41 } // namespace web | 58 } // namespace web |
42 | 59 |
43 #endif // IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ | 60 #endif // IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ |
OLD | NEW |