summaryrefslogtreecommitdiffstats
path: root/ios/web/public/test/test_web_state.cc
blob: d8d5a4072eb611482045f66df8cef38d5de6fdfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ios/web/public/test/test_web_state.h"

namespace web {

TestWebState::TestWebState() : trust_level_(kAbsolute), content_is_html_(true) {
}

TestWebState::~TestWebState() = default;

UIView* TestWebState::GetView() {
  return nullptr;
}

WebViewType TestWebState::GetWebViewType() const {
  return web::UI_WEB_VIEW_TYPE;
}

BrowserState* TestWebState::GetBrowserState() const {
  return nullptr;
}

NavigationManager* TestWebState::GetNavigationManager() {
  return nullptr;
}

CRWJSInjectionReceiver* TestWebState::GetJSInjectionReceiver() const {
  return nullptr;
}

const std::string& TestWebState::GetContentsMimeType() const {
  return mime_type_;
}

const std::string& TestWebState::GetContentLanguageHeader() const {
  return content_language_;
}

bool TestWebState::ContentIsHTML() const {
  return content_is_html_;
}

const GURL& TestWebState::GetVisibleURL() const {
  return url_;
}

const GURL& TestWebState::GetLastCommittedURL() const {
  return url_;
}

GURL TestWebState::GetCurrentURL(URLVerificationTrustLevel* trust_level) const {
  *trust_level = trust_level_;
  return url_;
}

bool TestWebState::IsShowingWebInterstitial() const {
  return false;
}

WebInterstitial* TestWebState::GetWebInterstitial() const {
  return nullptr;
}

void TestWebState::SetContentIsHTML(bool content_is_html) {
  content_is_html_ = content_is_html;
}

const base::string16& TestWebState::GetTitle() const {
  return title_;
}

bool TestWebState::IsLoading() const {
  return false;
}

void TestWebState::SetCurrentURL(const GURL& url) {
  url_ = url;
}

void TestWebState::SetTrustLevel(URLVerificationTrustLevel trust_level) {
  trust_level_ = trust_level;
}

CRWWebViewProxyType TestWebState::GetWebViewProxy() const {
  return nullptr;
}

int TestWebState::DownloadImage(const GURL& url,
                                bool is_favicon,
                                uint32_t max_bitmap_size,
                                bool bypass_cache,
                                const ImageDownloadCallback& callback) {
  return 0;
}

}  // namespace web