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 ShowTransientContentView(CRWContentView
* content_view
) override
{}
37 void AddScriptCommandCallback(const ScriptCommandCallback
& callback
,
38 const std::string
& command_prefix
) override
{}
39 void RemoveScriptCommandCallback(const std::string
& command_prefix
) override
{
41 CRWWebViewProxyType
GetWebViewProxy() const override
;
42 bool IsShowingWebInterstitial() const override
;
43 WebInterstitial
* GetWebInterstitial() const override
;
44 void AddObserver(WebStateObserver
* observer
) override
{}
45 void RemoveObserver(WebStateObserver
* observer
) override
{}
46 int DownloadImage(const GURL
& url
,
48 uint32_t max_bitmap_size
,
50 const ImageDownloadCallback
& callback
) override
;
52 // Setters for test data.
53 void SetContentIsHTML(bool content_is_html
);
54 void SetCurrentURL(const GURL
& url
);
55 void SetTrustLevel(URLVerificationTrustLevel trust_level
);
59 URLVerificationTrustLevel trust_level_
;
60 bool content_is_html_
;
61 std::string mime_type_
;
62 std::string content_language_
;
67 #endif // IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_