Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: chrome/browser/ui/website_settings/mock_permission_bubble_request.cc

Issue 292453009: Handles iframe permissions requests separately, in a subsequent bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: unit test edit Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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),
13 cancelled_(false),
14 finished_(false),
15 user_gesture_(false) {
13 text_ = base::ASCIIToUTF16("test"); 16 text_ = base::ASCIIToUTF16("test");
14 accept_label_ = base::ASCIIToUTF16("button"); 17 accept_label_ = base::ASCIIToUTF16("button");
15 deny_label_ = base::ASCIIToUTF16("button"); 18 deny_label_ = base::ASCIIToUTF16("button");
19 hostname_ = GURL("http://www.google.com");
16 } 20 }
17 21
18 MockPermissionBubbleRequest::MockPermissionBubbleRequest( 22 MockPermissionBubbleRequest::MockPermissionBubbleRequest(
19 const std::string& text) 23 const std::string& text)
20 : granted_(false), cancelled_(false), finished_(false) { 24 : granted_(false),
25 cancelled_(false),
26 finished_(false),
27 user_gesture_(false) {
21 text_ = base::UTF8ToUTF16(text); 28 text_ = base::UTF8ToUTF16(text);
22 accept_label_ = base::ASCIIToUTF16("button"); 29 accept_label_ = base::ASCIIToUTF16("button");
23 deny_label_ = base::ASCIIToUTF16("button"); 30 deny_label_ = base::ASCIIToUTF16("button");
31 hostname_ = GURL("http://www.google.com");
24 } 32 }
25 33
26 MockPermissionBubbleRequest::MockPermissionBubbleRequest( 34 MockPermissionBubbleRequest::MockPermissionBubbleRequest(
27 const std::string& text, const std::string& accept_label, 35 const std::string& text,
36 const GURL& url)
37 : granted_(false),
38 cancelled_(false),
39 finished_(false),
40 user_gesture_(false) {
41 text_ = base::UTF8ToUTF16(text);
42 accept_label_ = base::ASCIIToUTF16("button");
43 deny_label_ = base::ASCIIToUTF16("button");
44 hostname_ = url;
45 }
46
47 MockPermissionBubbleRequest::MockPermissionBubbleRequest(
48 const std::string& text,
49 const std::string& accept_label,
28 const std::string& deny_label) 50 const std::string& deny_label)
29 : granted_(false), cancelled_(false), finished_(false) { 51 : granted_(false),
52 cancelled_(false),
53 finished_(false),
54 user_gesture_(false) {
30 text_ = base::UTF8ToUTF16(text); 55 text_ = base::UTF8ToUTF16(text);
31 accept_label_ = base::UTF8ToUTF16(accept_label); 56 accept_label_ = base::UTF8ToUTF16(accept_label);
32 deny_label_ = base::UTF8ToUTF16(deny_label); 57 deny_label_ = base::UTF8ToUTF16(deny_label);
58 hostname_ = GURL("http://www.google.com");
33 } 59 }
34 60
35 MockPermissionBubbleRequest::~MockPermissionBubbleRequest() {} 61 MockPermissionBubbleRequest::~MockPermissionBubbleRequest() {}
36 62
37 int MockPermissionBubbleRequest::GetIconID() const { 63 int MockPermissionBubbleRequest::GetIconID() const {
38 // Use a valid icon ID to support UI tests. 64 // Use a valid icon ID to support UI tests.
39 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; 65 return IDR_INFOBAR_MEDIA_STREAM_CAMERA;
40 } 66 }
41 67
42 base::string16 MockPermissionBubbleRequest::GetMessageText() const { 68 base::string16 MockPermissionBubbleRequest::GetMessageText() const {
43 return text_; 69 return text_;
44 } 70 }
45 71
46 base::string16 MockPermissionBubbleRequest::GetMessageTextFragment() const { 72 base::string16 MockPermissionBubbleRequest::GetMessageTextFragment() const {
47 return text_; 73 return text_;
48 } 74 }
49 75
50 bool MockPermissionBubbleRequest::HasUserGesture() const { 76 bool MockPermissionBubbleRequest::HasUserGesture() const {
51 return false; 77 return user_gesture_;
52 } 78 }
53 79
54 GURL MockPermissionBubbleRequest::GetRequestingHostname() const { 80 GURL MockPermissionBubbleRequest::GetRequestingHostname() const {
55 return GURL("http://www.google.com"); 81 return hostname_;
56 } 82 }
57 83
58 void MockPermissionBubbleRequest::PermissionGranted() { 84 void MockPermissionBubbleRequest::PermissionGranted() {
59 granted_ = true; 85 granted_ = true;
60 } 86 }
61 87
62 void MockPermissionBubbleRequest::PermissionDenied() { 88 void MockPermissionBubbleRequest::PermissionDenied() {
63 granted_ = false; 89 granted_ = false;
64 } 90 }
65 91
(...skipping 10 matching lines...) Expand all
76 return granted_; 102 return granted_;
77 } 103 }
78 104
79 bool MockPermissionBubbleRequest::cancelled() { 105 bool MockPermissionBubbleRequest::cancelled() {
80 return cancelled_; 106 return cancelled_;
81 } 107 }
82 108
83 bool MockPermissionBubbleRequest::finished() { 109 bool MockPermissionBubbleRequest::finished() {
84 return finished_; 110 return finished_;
85 } 111 }
112
113 void MockPermissionBubbleRequest::SetHasUserGesture() {
114 user_gesture_ = true;
115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698