summaryrefslogtreecommitdiffstats
path: root/components/test_runner/mock_credential_manager_client.h
blob: 03a25093de3055c766f1ed0533fa12802c8889b6 (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.

#ifndef COMPONENTS_TEST_RUNNER_MOCK_CREDENTIAL_MANAGER_CLIENT_H_
#define COMPONENTS_TEST_RUNNER_MOCK_CREDENTIAL_MANAGER_CLIENT_H_

#include "base/memory/scoped_ptr.h"
#include "third_party/WebKit/public/platform/WebCredentialManagerClient.h"
#include "third_party/WebKit/public/platform/WebVector.h"

namespace blink {
class WebCredential;
class WebFrame;
class WebURL;
}

namespace test_runner {

class MockCredentialManagerClient : public blink::WebCredentialManagerClient {
 public:
  MockCredentialManagerClient();
  virtual ~MockCredentialManagerClient();

  // We take ownership of the |credential|.
  void SetResponse(blink::WebCredential* credential);

  // blink::WebCredentialManager:
  virtual void dispatchSignedIn(const blink::WebCredential& credential,
                                NotificationCallbacks* callbacks);
  virtual void dispatchRequireUserMediation(NotificationCallbacks* callbacks);
  virtual void dispatchRequest(
      bool zero_click_only,
      const blink::WebVector<blink::WebURL>& federations,
      RequestCallbacks* callbacks);

 private:
  scoped_ptr<blink::WebCredential> credential_;

  DISALLOW_COPY_AND_ASSIGN(MockCredentialManagerClient);
};

}  // namespace test_runner

#endif  // COMPONENTS_TEST_RUNNER_MOCK_CREDENTIAL_MANAGER_CLIENT_H_