forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review URL: https://codereview.chromium.org/787863002 Cr-Commit-Position: refs/heads/master@{#307664}
- Loading branch information
droger
authored and
Commit bot
committed
Dec 10, 2014
1 parent
c6296b2
commit 2f86335
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 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 { | ||
|
||
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 true; | ||
} | ||
|
||
const GURL& TestWebState::GetVisibleURL() const { | ||
return url_; | ||
} | ||
|
||
const GURL& TestWebState::GetLastCommittedURL() const { | ||
return url_; | ||
} | ||
|
||
} // namespace web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// 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. | ||
|
||
#ifndef IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ | ||
#define IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ | ||
|
||
#include <string> | ||
|
||
#include "ios/web/public/web_state/web_state.h" | ||
#include "url/gurl.h" | ||
|
||
namespace web { | ||
|
||
// Minimal implementation of WebState, to be used in tests. | ||
class TestWebState : public WebState { | ||
public: | ||
// WebState implementation. | ||
virtual BrowserState* GetBrowserState() const override; | ||
virtual void OpenURL(const OpenURLParams& params) override {} | ||
virtual NavigationManager* GetNavigationManager() override; | ||
virtual CRWJSInjectionReceiver* GetJSInjectionReceiver() const override; | ||
virtual const std::string& GetContentsMimeType() const override; | ||
virtual const std::string& GetContentLanguageHeader() const override; | ||
virtual bool ContentIsHTML() const override; | ||
virtual const GURL& GetVisibleURL() const override; | ||
virtual const GURL& GetLastCommittedURL() const override; | ||
virtual void AddScriptCommandCallback( | ||
const ScriptCommandCallback& callback, | ||
const std::string& command_prefix) override {} | ||
virtual void RemoveScriptCommandCallback( | ||
const std::string& command_prefix) override {} | ||
virtual void AddObserver(WebStateObserver* observer) override {} | ||
virtual void RemoveObserver(WebStateObserver* observer) override {} | ||
|
||
private: | ||
GURL url_; | ||
std::string mime_type_; | ||
std::string content_language_; | ||
}; | ||
|
||
} // namespace web | ||
|
||
#endif // IOS_WEB_PUBLIC_TEST_TEST_WEB_STATE_H_ |