| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "ios/web/public/web_state/url_verification_constants.h" | 13 #include "ios/web/public/web_state/url_verification_constants.h" |
| 14 #include "ios/web/public/web_state/web_state.h" | 14 #include "ios/web/public/web_state/web_state.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 | 16 |
| 17 namespace web { | 17 namespace web { |
| 18 | 18 |
| 19 // Minimal implementation of WebState, to be used in tests. | 19 // Minimal implementation of WebState, to be used in tests. |
| 20 class TestWebState : public WebState { | 20 class TestWebState : public WebState { |
| 21 public: | 21 public: |
| 22 TestWebState(); | 22 TestWebState(); |
| 23 ~TestWebState() override; | 23 ~TestWebState() override; |
| 24 | 24 |
| 25 // WebState implementation. | 25 // WebState implementation. |
| 26 UIView* GetView() override; | |
| 27 WebStateDelegate* GetDelegate() override; | 26 WebStateDelegate* GetDelegate() override; |
| 28 void SetDelegate(WebStateDelegate* delegate) override; | 27 void SetDelegate(WebStateDelegate* delegate) override; |
| 28 bool IsWebUsageEnabled() const override; |
| 29 void SetWebUsageEnabled(bool enabled) override; |
| 30 UIView* GetView() override; |
| 29 BrowserState* GetBrowserState() const override; | 31 BrowserState* GetBrowserState() const override; |
| 30 void OpenURL(const OpenURLParams& params) override {} | 32 void OpenURL(const OpenURLParams& params) override {} |
| 31 NavigationManager* GetNavigationManager() override; | 33 NavigationManager* GetNavigationManager() override; |
| 32 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; | 34 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; |
| 33 void ExecuteJavaScript(const base::string16& javascript) override; | 35 void ExecuteJavaScript(const base::string16& javascript) override; |
| 34 void ExecuteJavaScript(const base::string16& javascript, | 36 void ExecuteJavaScript(const base::string16& javascript, |
| 35 const JavaScriptResultCallback& callback) override; | 37 const JavaScriptResultCallback& callback) override; |
| 36 const std::string& GetContentsMimeType() const override; | 38 const std::string& GetContentsMimeType() const override; |
| 37 const std::string& GetContentLanguageHeader() const override; | 39 const std::string& GetContentLanguageHeader() const override; |
| 38 bool ContentIsHTML() const override; | 40 bool ContentIsHTML() const override; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 61 bool bypass_cache, | 63 bool bypass_cache, |
| 62 const ImageDownloadCallback& callback) override; | 64 const ImageDownloadCallback& callback) override; |
| 63 base::WeakPtr<WebState> AsWeakPtr() override; | 65 base::WeakPtr<WebState> AsWeakPtr() override; |
| 64 | 66 |
| 65 // Setters for test data. | 67 // Setters for test data. |
| 66 void SetContentIsHTML(bool content_is_html); | 68 void SetContentIsHTML(bool content_is_html); |
| 67 void SetCurrentURL(const GURL& url); | 69 void SetCurrentURL(const GURL& url); |
| 68 void SetTrustLevel(URLVerificationTrustLevel trust_level); | 70 void SetTrustLevel(URLVerificationTrustLevel trust_level); |
| 69 | 71 |
| 70 private: | 72 private: |
| 73 bool web_usage_enabled_; |
| 71 GURL url_; | 74 GURL url_; |
| 72 base::string16 title_; | 75 base::string16 title_; |
| 73 URLVerificationTrustLevel trust_level_; | 76 URLVerificationTrustLevel trust_level_; |
| 74 bool content_is_html_; | 77 bool content_is_html_; |
| 75 std::string mime_type_; | 78 std::string mime_type_; |
| 76 std::string content_language_; | 79 std::string content_language_; |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 } // namespace web | 82 } // namespace web |
| 80 | 83 |
| 81 #endif // IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ | 84 #endif // IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ |
| OLD | NEW |