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

Unified Diff: components/test_runner/test_runner.cc

Issue 2373503003: Add clean up logic to navigator.credentials layout tests (Closed)
Patch Set: Created 4 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: components/test_runner/test_runner.cc
diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc
index 4da42d73251f62257484d6aaf6ccb945adca25e1..86185b48a8917e53e83714249e615ee18fc4d34a 100644
--- a/components/test_runner/test_runner.cc
+++ b/components/test_runner/test_runner.cc
@@ -257,11 +257,12 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> {
void WaitForPolicyDelegate();
void WaitUntilDone();
void WaitUntilExternalURLLoad();
- void AddMockCredentialManagerError(const std::string& error);
- void AddMockCredentialManagerResponse(const std::string& id,
+ void SetMockCredentialManagerError(const std::string& error);
+ void SetMockCredentialManagerResponse(const std::string& id,
const std::string& name,
const std::string& avatar,
const std::string& password);
+ void ClearMockCredentialManagerResponse();
bool AnimationScheduled();
bool CallShouldCloseOnWebView();
bool DisableAutoResizeMode(int new_width, int new_height);
@@ -336,10 +337,12 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder(
return gin::Wrappable<TestRunnerBindings>::GetObjectTemplateBuilder(isolate)
.SetMethod("abortModal", &TestRunnerBindings::NotImplemented)
.SetMethod("addDisallowedURL", &TestRunnerBindings::NotImplemented)
- .SetMethod("addMockCredentialManagerError",
- &TestRunnerBindings::AddMockCredentialManagerError)
- .SetMethod("addMockCredentialManagerResponse",
- &TestRunnerBindings::AddMockCredentialManagerResponse)
+ .SetMethod("setMockCredentialManagerError",
+ &TestRunnerBindings::SetMockCredentialManagerError)
+ .SetMethod("setMockCredentialManagerResponse",
+ &TestRunnerBindings::SetMockCredentialManagerResponse)
+ .SetMethod("clearMockCredentialManagerResponse",
+ &TestRunnerBindings::ClearMockCredentialManagerResponse)
.SetMethod("addMockSpeechRecognitionResult",
&TestRunnerBindings::AddMockSpeechRecognitionResult)
.SetMethod("addOriginAccessWhitelistEntry",
@@ -1376,19 +1379,24 @@ void TestRunnerBindings::SetMockSpeechRecognitionError(
runner_->SetMockSpeechRecognitionError(error, message);
}
-void TestRunnerBindings::AddMockCredentialManagerResponse(
+void TestRunnerBindings::SetMockCredentialManagerResponse(
const std::string& id,
const std::string& name,
const std::string& avatar,
const std::string& password) {
if (runner_)
- runner_->AddMockCredentialManagerResponse(id, name, avatar, password);
+ runner_->SetMockCredentialManagerResponse(id, name, avatar, password);
}
-void TestRunnerBindings::AddMockCredentialManagerError(
+void TestRunnerBindings::ClearMockCredentialManagerResponse() {
+ if (runner_)
+ runner_->ClearMockCredentialManagerResponse();
+}
+
+void TestRunnerBindings::SetMockCredentialManagerError(
const std::string& error) {
if (runner_)
- runner_->AddMockCredentialManagerError(error);
+ runner_->SetMockCredentialManagerError(error);
}
void TestRunnerBindings::AddWebPageOverlay() {
@@ -2699,7 +2707,7 @@ void TestRunner::SetMockSpeechRecognitionError(const std::string& error,
WebString::fromUTF8(message));
}
-void TestRunner::AddMockCredentialManagerResponse(const std::string& id,
+void TestRunner::SetMockCredentialManagerResponse(const std::string& id,
const std::string& name,
const std::string& avatar,
const std::string& password) {
@@ -2708,7 +2716,11 @@ void TestRunner::AddMockCredentialManagerResponse(const std::string& id,
WebString::fromUTF8(name), WebURL(GURL(avatar))));
}
-void TestRunner::AddMockCredentialManagerError(const std::string& error) {
+void TestRunner::ClearMockCredentialManagerResponse() {
+ credential_manager_client_->SetResponse(nullptr);
+}
+
+void TestRunner::SetMockCredentialManagerError(const std::string& error) {
credential_manager_client_->SetError(error);
}

Powered by Google App Engine
This is Rietveld 408576698