~osomon/oxide/camera-names-i18n

« back to all changes in this revision

Viewing changes to qt/core/api/oxideqcertificateerror_p.h

  • Committer: Chris Coulson
  • Date: 2016-04-18 10:53:32 UTC
  • mfrom: (1378.1.44 unit-testing)
  • Revision ID: chris.coulson@canonical.com-20160418105332-h9b6vhimddqtt7vp
Expand testing capability - this adds 2 new test suites:
- API unit tests (qt/tests/unit). These are compiled unit tests for public APIs and are expected to be fairly limited in scope, and not require a full browser process.
- Internal unit tests. This will allow unit testing of internal classes that can be tested without requiring a full browser process.
I've not added many tests yet - future commits will expand on these.

There's still a hole in test capability - testing internal classes that require a full browser process. For these, I plan to add a test shell binary that will allow this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// vim:expandtab:shiftwidth=2:tabstop=2:
2
 
// Copyright (C) 2014-2015 Canonical Ltd.
 
2
// Copyright (C) 2014-2016 Canonical Ltd.
3
3
 
4
4
// This library is free software; you can redistribute it and/or
5
5
// modify it under the terms of the GNU Lesser General Public
18
18
#ifndef _OXIDE_QT_CORE_API_CERTIFICATE_ERROR_P_H_
19
19
#define _OXIDE_QT_CORE_API_CERTIFICATE_ERROR_P_H_
20
20
 
 
21
#include <functional>
 
22
#include <memory>
21
23
#include <QtGlobal>
22
24
 
23
 
#include "base/memory/scoped_ptr.h"
24
 
 
25
25
#include "qt/core/api/oxideqcertificateerror.h"
 
26
#include "qt/core/api/oxideqglobal.h"
26
27
#include "qt/core/api/oxideqsslcertificate.h"
27
28
 
28
29
namespace oxide {
29
30
class CertificateError;
30
31
}
31
32
 
32
 
class OxideQSslCertificate;
33
 
 
34
 
class OxideQCertificateErrorPrivate final {
 
33
class OXIDE_QTCORE_EXPORT OxideQCertificateErrorPrivate final {
35
34
  Q_DECLARE_PUBLIC(OxideQCertificateError)
36
35
 
37
36
 public:
38
37
  ~OxideQCertificateErrorPrivate();
39
38
 
40
 
  static OxideQCertificateError* Create(
41
 
      scoped_ptr<oxide::CertificateError> error,
 
39
  static OxideQCertificateErrorPrivate* get(OxideQCertificateError* q);
 
40
 
 
41
  static std::unique_ptr<OxideQCertificateError> Create(
 
42
      std::unique_ptr<oxide::CertificateError> error,
42
43
      QObject* parent = nullptr);
43
44
 
 
45
  typedef void (*ResponseCallback)(bool);
 
46
 
 
47
  static std::unique_ptr<OxideQCertificateError> CreateForTesting(
 
48
      bool is_main_frame,
 
49
      bool is_subresource,
 
50
      OxideQCertificateError::Error error,
 
51
      const OxideQSslCertificate& cert,
 
52
      const QUrl& url,
 
53
      bool strict_enforcement,
 
54
      bool overridable,
 
55
      const std::function<void(bool)>& callback);
 
56
 
 
57
  void SimulateCancel();
 
58
 
44
59
 private:
45
60
  OxideQCertificateErrorPrivate(
46
 
      scoped_ptr<oxide::CertificateError> error);
 
61
      std::unique_ptr<oxide::CertificateError> error);
47
62
 
48
63
  void OnCancel();
49
64
  void respond(bool accept);
51
66
  OxideQCertificateError* q_ptr;
52
67
 
53
68
  OxideQSslCertificate certificate_;
54
 
  scoped_ptr<oxide::CertificateError> error_;
 
69
  std::unique_ptr<oxide::CertificateError> error_;
55
70
 
56
71
  bool did_respond_;
57
72
};