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.
5 #include "chrome/browser/ui/website_settings/mock_permission_bubble_request.h"
7 #include "base/strings/string16.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "grit/theme_resources.h"
11 MockPermissionBubbleRequest::MockPermissionBubbleRequest()
15 user_gesture_(false) {
16 text_
= base::ASCIIToUTF16("test");
17 accept_label_
= base::ASCIIToUTF16("button");
18 deny_label_
= base::ASCIIToUTF16("button");
19 hostname_
= GURL("http://www.google.com");
22 MockPermissionBubbleRequest::MockPermissionBubbleRequest(
23 const std::string
& text
)
27 user_gesture_(false) {
28 text_
= base::UTF8ToUTF16(text
);
29 accept_label_
= base::ASCIIToUTF16("button");
30 deny_label_
= base::ASCIIToUTF16("button");
31 hostname_
= GURL("http://www.google.com");
34 MockPermissionBubbleRequest::MockPermissionBubbleRequest(
35 const std::string
& text
,
40 user_gesture_(false) {
41 text_
= base::UTF8ToUTF16(text
);
42 accept_label_
= base::ASCIIToUTF16("button");
43 deny_label_
= base::ASCIIToUTF16("button");
47 MockPermissionBubbleRequest::MockPermissionBubbleRequest(
48 const std::string
& text
,
49 const std::string
& accept_label
,
50 const std::string
& deny_label
)
54 user_gesture_(false) {
55 text_
= base::UTF8ToUTF16(text
);
56 accept_label_
= base::UTF8ToUTF16(accept_label
);
57 deny_label_
= base::UTF8ToUTF16(deny_label
);
58 hostname_
= GURL("http://www.google.com");
61 MockPermissionBubbleRequest::~MockPermissionBubbleRequest() {}
63 int MockPermissionBubbleRequest::GetIconId() const {
64 // Use a valid icon ID to support UI tests.
65 return IDR_INFOBAR_MEDIA_STREAM_CAMERA
;
68 base::string16
MockPermissionBubbleRequest::GetMessageText() const {
72 base::string16
MockPermissionBubbleRequest::GetMessageTextFragment() const {
76 bool MockPermissionBubbleRequest::HasUserGesture() const {
80 GURL
MockPermissionBubbleRequest::GetRequestingHostname() const {
84 void MockPermissionBubbleRequest::PermissionGranted() {
88 void MockPermissionBubbleRequest::PermissionDenied() {
92 void MockPermissionBubbleRequest::Cancelled() {
97 void MockPermissionBubbleRequest::RequestFinished() {
101 bool MockPermissionBubbleRequest::granted() {
105 bool MockPermissionBubbleRequest::cancelled() {
109 bool MockPermissionBubbleRequest::finished() {
113 void MockPermissionBubbleRequest::SetHasUserGesture() {
114 user_gesture_
= true;