QUIC - cleanup changes to sync chromium tree with internal source.
[chromium-blink-merge.git] / ios / web / public / test / test_web_state.h
blob56b58067e8fa0d917c7fd8e49e4ddaa80b9fff9b
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_
8 #include <string>
10 #include "base/strings/string16.h"
11 #include "ios/web/public/web_state/url_verification_constants.h"
12 #include "ios/web/public/web_state/web_state.h"
13 #include "url/gurl.h"
15 namespace web {
17 // Minimal implementation of WebState, to be used in tests.
18 class TestWebState : public WebState {
19 public:
20 TestWebState();
21 ~TestWebState() override;
23 // WebState implementation.
24 UIView* GetView() override;
25 WebViewType GetWebViewType() const override;
26 BrowserState* GetBrowserState() const override;
27 void OpenURL(const OpenURLParams& params) override {}
28 NavigationManager* GetNavigationManager() override;
29 CRWJSInjectionReceiver* GetJSInjectionReceiver() const override;
30 const std::string& GetContentsMimeType() const override;
31 const std::string& GetContentLanguageHeader() const override;
32 bool ContentIsHTML() const override;
33 const base::string16& GetTitle() const override;
34 bool IsLoading() const override;
35 const GURL& GetVisibleURL() const override;
36 const GURL& GetLastCommittedURL() const override;
37 GURL GetCurrentURL(URLVerificationTrustLevel* trust_level) const override;
38 void ShowTransientContentView(CRWContentView* content_view) override {}
39 void AddScriptCommandCallback(const ScriptCommandCallback& callback,
40 const std::string& command_prefix) override {}
41 void RemoveScriptCommandCallback(const std::string& command_prefix) override {
43 CRWWebViewProxyType GetWebViewProxy() const override;
44 bool IsShowingWebInterstitial() const override;
45 WebInterstitial* GetWebInterstitial() const override;
46 void AddObserver(WebStateObserver* observer) override {}
47 void RemoveObserver(WebStateObserver* observer) override {}
48 void AddPolicyDecider(WebStatePolicyDecider* decider) override {}
49 void RemovePolicyDecider(WebStatePolicyDecider* decider) override {}
50 int DownloadImage(const GURL& url,
51 bool is_favicon,
52 uint32_t max_bitmap_size,
53 bool bypass_cache,
54 const ImageDownloadCallback& callback) override;
56 // Setters for test data.
57 void SetContentIsHTML(bool content_is_html);
58 void SetCurrentURL(const GURL& url);
59 void SetTrustLevel(URLVerificationTrustLevel trust_level);
61 private:
62 GURL url_;
63 base::string16 title_;
64 URLVerificationTrustLevel trust_level_;
65 bool content_is_html_;
66 std::string mime_type_;
67 std::string content_language_;
70 } // namespace web
72 #endif // IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_