summaryrefslogtreecommitdiffstats
path: root/chrome/browser/mock_browsing_data_server_bound_cert_helper.h
blob: 0630be07fa03b2fd03b79d3d76ed44bb1eaac16e (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
46
47
48
// Copyright (c) 2012 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 CHROME_BROWSER_MOCK_BROWSING_DATA_SERVER_BOUND_CERT_HELPER_H_
#define CHROME_BROWSER_MOCK_BROWSING_DATA_SERVER_BOUND_CERT_HELPER_H_
#pragma once

#include <map>
#include <string>

#include "chrome/browser/browsing_data_server_bound_cert_helper.h"

// Mock for BrowsingDataServerBoundCertHelper.
class MockBrowsingDataServerBoundCertHelper
    : public BrowsingDataServerBoundCertHelper {
 public:
  explicit MockBrowsingDataServerBoundCertHelper();

  // BrowsingDataServerBoundCertHelper methods.
  virtual void StartFetching(const FetchResultCallback& callback) OVERRIDE;
  virtual void DeleteServerBoundCert(const std::string& server_id) OVERRIDE;

  // Adds a server_bound_cert sample.
  void AddServerBoundCertSample(const std::string& server_id);

  // Notifies the callback.
  void Notify();

  // Marks all server_bound_certs as existing.
  void Reset();

  // Returns true if all server_bound_certs since the last Reset() invocation
  // were deleted.
  bool AllDeleted();

 private:
  virtual ~MockBrowsingDataServerBoundCertHelper();

  FetchResultCallback callback_;

  net::ServerBoundCertStore::ServerBoundCertList server_bound_cert_list_;

  // Stores which server_bound_certs exist.
  std::map<const std::string, bool> server_bound_certs_;
};

#endif  // CHROME_BROWSER_MOCK_BROWSING_DATA_SERVER_BOUND_CERT_HELPER_H_