summaryrefslogtreecommitdiffstats
path: root/components/test_runner/mock_credential_manager_client.cc
blob: 6b408fcc3fd70d55eb1b722d2d128778a36a6e47 (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
// 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 "components/test_runner/mock_credential_manager_client.h"

#include "third_party/WebKit/public/platform/WebCredential.h"
#include "third_party/WebKit/public/platform/WebPassOwnPtr.h"

namespace test_runner {

MockCredentialManagerClient::MockCredentialManagerClient() {
}

MockCredentialManagerClient::~MockCredentialManagerClient() {
}

void MockCredentialManagerClient::SetResponse(
    blink::WebCredential* credential) {
  credential_.reset(credential);
}

void MockCredentialManagerClient::dispatchStore(
    const blink::WebCredential&,
    blink::WebCredentialManagerClient::NotificationCallbacks* callbacks) {
  callbacks->onSuccess();
  delete callbacks;
}

void MockCredentialManagerClient::dispatchRequireUserMediation(
    NotificationCallbacks* callbacks) {
  callbacks->onSuccess();
  delete callbacks;
}

void MockCredentialManagerClient::dispatchGet(
    bool zero_click_only,
    bool include_passwords,
    const blink::WebVector<blink::WebURL>& federations,
    RequestCallbacks* callbacks) {
  callbacks->onSuccess(adoptWebPtr(credential_.release()));
  delete callbacks;
}

}  // namespace test_runner