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
3 // found in the LICENSE file.
5 #ifndef IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_
6 #define IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_
10 #include "ios/web/public/web_state/url_verification_constants.h"
11 #include "ios/web/public/web_state/web_state.h"
16 // Minimal implementation of WebState, to be used in tests.
17 class TestWebState
: public WebState
{
20 ~TestWebState() override
;
22 // WebState implementation.
23 UIView
* GetView() override
;
24 WebViewType
GetWebViewType() const override
;
25 BrowserState
* GetBrowserState() const override
;
26 void OpenURL(const OpenURLParams
& params
) override
{}
27 NavigationManager
* GetNavigationManager() override
;
28 CRWJSInjectionReceiver
* GetJSInjectionReceiver() const override
;
29 const std::string
& GetContentsMimeType() const override
;
30 const std::string
& GetContentLanguageHeader() const override
;
31 bool ContentIsHTML() const override
;
32 bool IsLoading() const override
;
33 const GURL
& GetVisibleURL() const override
;
34 const GURL
& GetLastCommittedURL() const override
;
35 GURL
GetCurrentURL(URLVerificationTrustLevel
* trust_level
) const override
;
36 void AddScriptCommandCallback(const ScriptCommandCallback
& callback
,
37 const std::string
& command_prefix
) override
{}
38 void RemoveScriptCommandCallback(const std::string
& command_prefix
) override
{
40 CRWWebViewProxyType
GetWebViewProxy() const override
;
41 bool IsShowingWebInterstitial() const override
;
42 WebInterstitial
* GetWebInterstitial() const override
;
43 void AddObserver(WebStateObserver
* observer
) override
{}
44 void RemoveObserver(WebStateObserver
* observer
) override
{}
45 int DownloadImage(const GURL
& url
,
47 uint32_t max_bitmap_size
,
49 const ImageDownloadCallback
& callback
) override
;
51 // Setters for test data.
52 void SetContentIsHTML(bool content_is_html
);
53 void SetCurrentURL(const GURL
& url
);
54 void SetTrustLevel(URLVerificationTrustLevel trust_level
);
58 URLVerificationTrustLevel trust_level_
;
59 bool content_is_html_
;
60 std::string mime_type_
;
61 std::string content_language_
;
66 #endif // IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_