Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2518)

Unified Diff: content/shell/renderer/test_runner/test_runner.cc

Issue 565943002: Credential Manager: Introduce a MockCredentialManagerClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/renderer/test_runner/test_runner.cc
diff --git a/content/shell/renderer/test_runner/test_runner.cc b/content/shell/renderer/test_runner/test_runner.cc
index fe33ffe73ea383cbbaca39baff1485aa8ed75720..ab5e18a729b95f6bdbfa8095597998544bd46024 100644
--- a/content/shell/renderer/test_runner/test_runner.cc
+++ b/content/shell/renderer/test_runner/test_runner.cc
@@ -10,6 +10,7 @@
#include "content/shell/common/test_runner/test_preferences.h"
#include "content/shell/renderer/binding_helpers.h"
#include "content/shell/renderer/test_runner/WebTestDelegate.h"
+#include "content/shell/renderer/test_runner/mock_credential_manager_client.h"
#include "content/shell/renderer/test_runner/mock_web_push_client.h"
#include "content/shell/renderer/test_runner/mock_web_speech_recognizer.h"
#include "content/shell/renderer/test_runner/notification_presenter.h"
@@ -27,6 +28,7 @@
#include "third_party/WebKit/public/platform/WebData.h"
#include "third_party/WebKit/public/platform/WebDeviceMotionData.h"
#include "third_party/WebKit/public/platform/WebDeviceOrientationData.h"
+#include "third_party/WebKit/public/platform/WebLocalCredential.h"
#include "third_party/WebKit/public/platform/WebPoint.h"
#include "third_party/WebKit/public/platform/WebURLResponse.h"
#include "third_party/WebKit/public/web/WebArrayBufferConverter.h"
@@ -278,6 +280,10 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> {
void SetMockSpeechRecognitionError(const std::string& error,
const std::string& message);
bool WasMockSpeechRecognitionAborted();
+ void AddMockCredentialManagerResponse(const std::string& id,
+ const std::string& name,
+ const std::string& avatar,
+ const std::string& password);
void AddWebPageOverlay();
void RemoveWebPageOverlay();
void DisplayAsync();
@@ -515,6 +521,8 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder(
&TestRunnerBindings::SetMockSpeechRecognitionError)
.SetMethod("wasMockSpeechRecognitionAborted",
&TestRunnerBindings::WasMockSpeechRecognitionAborted)
+ .SetMethod("addMockCredentialManagerResponse",
+ &TestRunnerBindings::AddMockCredentialManagerResponse)
.SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay)
.SetMethod("removeWebPageOverlay",
&TestRunnerBindings::RemoveWebPageOverlay)
@@ -1323,6 +1331,15 @@ bool TestRunnerBindings::WasMockSpeechRecognitionAborted() {
return false;
}
+void TestRunnerBindings::AddMockCredentialManagerResponse(
+ const std::string& id,
+ const std::string& name,
+ const std::string& avatar,
+ const std::string& password) {
+ if (runner_)
+ runner_->AddMockCredentialManagerResponse(id, name, avatar, password);
+}
+
void TestRunnerBindings::AddWebPageOverlay() {
if (runner_)
runner_->AddWebPageOverlay();
@@ -2751,6 +2768,17 @@ bool TestRunner::WasMockSpeechRecognitionAborted() {
return proxy_->GetSpeechRecognizerMock()->WasAborted();
}
+void TestRunner::AddMockCredentialManagerResponse(const std::string& id,
+ const std::string& name,
+ const std::string& avatar,
+ const std::string& password) {
+ proxy_->GetCredentialManagerClientMock()->SetResponse(
+ new WebLocalCredential(WebString::fromUTF8(id),
+ WebString::fromUTF8(name),
+ WebURL(GURL(avatar)),
+ WebString::fromUTF8(password)));
+}
+
void TestRunner::AddWebPageOverlay() {
if (web_view_ && !page_overlay_) {
page_overlay_ = new TestPageOverlay(web_view_);
« no previous file with comments | « content/shell/renderer/test_runner/test_runner.h ('k') | content/shell/renderer/test_runner/web_test_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698