mock_permission_request.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_PERMISSIONS_TEST_MOCK_PERMISSION_REQUEST_H_
  5. #define COMPONENTS_PERMISSIONS_TEST_MOCK_PERMISSION_REQUEST_H_
  6. #include "components/permissions/permission_request.h"
  7. #include "url/gurl.h"
  8. namespace permissions {
  9. enum class RequestType;
  10. class MockPermissionRequest : public PermissionRequest {
  11. public:
  12. static constexpr const char* kDefaultOrigin = "https://www.google.com";
  13. explicit MockPermissionRequest(RequestType request_type);
  14. MockPermissionRequest(const GURL& requesting_origin,
  15. RequestType request_type);
  16. MockPermissionRequest(RequestType request_type,
  17. PermissionRequestGestureType gesture_type);
  18. MockPermissionRequest(const GURL& requesting_origin,
  19. RequestType request_type,
  20. PermissionRequestGestureType gesture_type);
  21. ~MockPermissionRequest() override;
  22. void PermissionDecided(ContentSetting result, bool is_one_time);
  23. void MarkFinished();
  24. bool granted();
  25. bool cancelled();
  26. bool finished();
  27. std::unique_ptr<MockPermissionRequest> CreateDuplicateRequest() const;
  28. private:
  29. bool granted_;
  30. bool cancelled_;
  31. bool finished_;
  32. };
  33. } // namespace permissions
  34. #endif // COMPONENTS_PERMISSIONS_TEST_MOCK_PERMISSION_REQUEST_H_