OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/website_settings/mock_permission_bubble_request.h" | 5 #include "chrome/browser/ui/website_settings/mock_permission_bubble_request.h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
10 | 10 |
11 MockPermissionBubbleRequest::MockPermissionBubbleRequest() | 11 MockPermissionBubbleRequest::MockPermissionBubbleRequest() |
12 : granted_(false), cancelled_(false), finished_(false) { | 12 : granted_(false), cancelled_(false), finished_(false) { |
13 text_ = base::ASCIIToUTF16("test"); | 13 text_ = base::ASCIIToUTF16("test"); |
14 accept_label_ = base::ASCIIToUTF16("button"); | 14 accept_label_ = base::ASCIIToUTF16("button"); |
15 deny_label_ = base::ASCIIToUTF16("button"); | 15 deny_label_ = base::ASCIIToUTF16("button"); |
| 16 hostname_ = GURL("http://www.google.com"); |
16 } | 17 } |
17 | 18 |
18 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | 19 MockPermissionBubbleRequest::MockPermissionBubbleRequest( |
19 const std::string& text) | 20 const std::string& text) |
20 : granted_(false), cancelled_(false), finished_(false) { | 21 : granted_(false), cancelled_(false), finished_(false) { |
21 text_ = base::UTF8ToUTF16(text); | 22 text_ = base::UTF8ToUTF16(text); |
22 accept_label_ = base::ASCIIToUTF16("button"); | 23 accept_label_ = base::ASCIIToUTF16("button"); |
23 deny_label_ = base::ASCIIToUTF16("button"); | 24 deny_label_ = base::ASCIIToUTF16("button"); |
| 25 hostname_ = GURL("http://www.google.com"); |
24 } | 26 } |
25 | 27 |
26 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | 28 MockPermissionBubbleRequest::MockPermissionBubbleRequest( |
| 29 const std::string& text, const GURL& url) |
| 30 : granted_(false), cancelled_(false), finished_(false) { |
| 31 text_ = base::UTF8ToUTF16(text); |
| 32 accept_label_ = base::ASCIIToUTF16("button"); |
| 33 deny_label_ = base::ASCIIToUTF16("button"); |
| 34 hostname_ = url; |
| 35 } |
| 36 |
| 37 MockPermissionBubbleRequest::MockPermissionBubbleRequest( |
27 const std::string& text, const std::string& accept_label, | 38 const std::string& text, const std::string& accept_label, |
28 const std::string& deny_label) | 39 const std::string& deny_label) |
29 : granted_(false), cancelled_(false), finished_(false) { | 40 : granted_(false), cancelled_(false), finished_(false) { |
30 text_ = base::UTF8ToUTF16(text); | 41 text_ = base::UTF8ToUTF16(text); |
31 accept_label_ = base::UTF8ToUTF16(accept_label); | 42 accept_label_ = base::UTF8ToUTF16(accept_label); |
32 deny_label_ = base::UTF8ToUTF16(deny_label); | 43 deny_label_ = base::UTF8ToUTF16(deny_label); |
| 44 hostname_ = GURL("http://www.google.com"); |
33 } | 45 } |
34 | 46 |
35 MockPermissionBubbleRequest::~MockPermissionBubbleRequest() {} | 47 MockPermissionBubbleRequest::~MockPermissionBubbleRequest() {} |
36 | 48 |
37 int MockPermissionBubbleRequest::GetIconID() const { | 49 int MockPermissionBubbleRequest::GetIconID() const { |
38 // Use a valid icon ID to support UI tests. | 50 // Use a valid icon ID to support UI tests. |
39 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; | 51 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; |
40 } | 52 } |
41 | 53 |
42 base::string16 MockPermissionBubbleRequest::GetMessageText() const { | 54 base::string16 MockPermissionBubbleRequest::GetMessageText() const { |
43 return text_; | 55 return text_; |
44 } | 56 } |
45 | 57 |
46 base::string16 MockPermissionBubbleRequest::GetMessageTextFragment() const { | 58 base::string16 MockPermissionBubbleRequest::GetMessageTextFragment() const { |
47 return text_; | 59 return text_; |
48 } | 60 } |
49 | 61 |
50 bool MockPermissionBubbleRequest::HasUserGesture() const { | 62 bool MockPermissionBubbleRequest::HasUserGesture() const { |
51 return false; | 63 return false; |
52 } | 64 } |
53 | 65 |
54 GURL MockPermissionBubbleRequest::GetRequestingHostname() const { | 66 GURL MockPermissionBubbleRequest::GetRequestingHostname() const { |
55 return GURL("http://www.google.com"); | 67 return hostname_; |
56 } | 68 } |
57 | 69 |
58 void MockPermissionBubbleRequest::PermissionGranted() { | 70 void MockPermissionBubbleRequest::PermissionGranted() { |
59 granted_ = true; | 71 granted_ = true; |
60 } | 72 } |
61 | 73 |
62 void MockPermissionBubbleRequest::PermissionDenied() { | 74 void MockPermissionBubbleRequest::PermissionDenied() { |
63 granted_ = false; | 75 granted_ = false; |
64 } | 76 } |
65 | 77 |
(...skipping 10 matching lines...) Expand all Loading... |
76 return granted_; | 88 return granted_; |
77 } | 89 } |
78 | 90 |
79 bool MockPermissionBubbleRequest::cancelled() { | 91 bool MockPermissionBubbleRequest::cancelled() { |
80 return cancelled_; | 92 return cancelled_; |
81 } | 93 } |
82 | 94 |
83 bool MockPermissionBubbleRequest::finished() { | 95 bool MockPermissionBubbleRequest::finished() { |
84 return finished_; | 96 return finished_; |
85 } | 97 } |
OLD | NEW |