| Index: chromeos/network/client_cert_resolver.h
|
| diff --git a/chromeos/network/client_cert_resolver.h b/chromeos/network/client_cert_resolver.h
|
| index d94873fa62bf3c0d9c87607e3b1ecb6adeda7b53..789b9014c2a0342cb3056948b07f73740ed26eed 100644
|
| --- a/chromeos/network/client_cert_resolver.h
|
| +++ b/chromeos/network/client_cert_resolver.h
|
| @@ -15,6 +15,7 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/observer_list.h"
|
| +#include "base/time/time.h"
|
| #include "chromeos/cert_loader.h"
|
| #include "chromeos/chromeos_export.h"
|
| #include "chromeos/network/client_cert_util.h"
|
| @@ -23,6 +24,7 @@
|
| #include "chromeos/network/network_state_handler_observer.h"
|
|
|
| namespace base {
|
| +class Clock;
|
| class TaskRunner;
|
| }
|
|
|
| @@ -74,10 +76,17 @@ class CHROMEOS_EXPORT ClientCertResolver : public NetworkStateHandlerObserver,
|
| // |Observer|.
|
| bool IsAnyResolveTaskRunning() const;
|
|
|
| + // Sets the clock for testing. This clock is used when checking the
|
| + // certificates for expiration.
|
| + void SetClockForTesting(scoped_ptr<base::Clock> clock);
|
| +
|
| // Returns true and sets the Shill properties that have to be configured in
|
| // |shill_properties| if the certificate pattern |pattern| could be resolved.
|
| // Returns false otherwise and sets empty Shill properties to clear the
|
| // certificate configuration.
|
| + // Note that it always uses the global clock when checking the certificates
|
| + // for
|
| + // expiration.
|
| static bool ResolveCertificatePatternSync(
|
| const client_cert::ConfigType client_cert_type,
|
| const CertificatePattern& pattern,
|
| @@ -86,6 +95,7 @@ class CHROMEOS_EXPORT ClientCertResolver : public NetworkStateHandlerObserver,
|
| private:
|
| // NetworkStateHandlerObserver overrides
|
| void NetworkListChanged() override;
|
| + void NetworkConnectionStateChanged(const NetworkState* network) override;
|
|
|
| // CertLoader::Observer overrides
|
| void OnCertificatesLoaded(const net::CertificateList& cert_list,
|
| @@ -110,6 +120,11 @@ class CHROMEOS_EXPORT ClientCertResolver : public NetworkStateHandlerObserver,
|
| // Trigger a ResolveRequestCompleted event on all observers.
|
| void NotifyResolveRequestCompleted();
|
|
|
| + // Returns Time::Now() unless a mock clock has been installed with
|
| + // SetClockForTesting, in which case the time according to that clock is used
|
| + // instead.
|
| + base::Time Now() const;
|
| +
|
| base::ObserverList<Observer> observers_;
|
|
|
| // The set of networks that were checked/resolved in previous passes. These
|
| @@ -135,6 +150,9 @@ class CHROMEOS_EXPORT ClientCertResolver : public NetworkStateHandlerObserver,
|
| // TaskRunner for slow tasks.
|
| scoped_refptr<base::TaskRunner> slow_task_runner_for_test_;
|
|
|
| + // Can be set for testing.
|
| + scoped_ptr<base::Clock> testing_clock_;
|
| +
|
| base::WeakPtrFactory<ClientCertResolver> weak_ptr_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ClientCertResolver);
|
|
|