| OLD | NEW |
| (Empty) |
| 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 | |
| 5 #include "chrome/browser/ui/website_settings/mock_permission_bubble_request.h" | |
| 6 | |
| 7 #include "base/strings/string16.h" | |
| 8 #include "base/strings/utf_string_conversions.h" | |
| 9 #include "grit/theme_resources.h" | |
| 10 | |
| 11 MockPermissionBubbleRequest::MockPermissionBubbleRequest() | |
| 12 : MockPermissionBubbleRequest("test", | |
| 13 "button", | |
| 14 "button", | |
| 15 GURL("http://www.google.com"), | |
| 16 PermissionBubbleType::UNKNOWN) {} | |
| 17 | |
| 18 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | |
| 19 const std::string& text) | |
| 20 : MockPermissionBubbleRequest(text, | |
| 21 "button", | |
| 22 "button", | |
| 23 GURL("http://www.google.com"), | |
| 24 PermissionBubbleType::UNKNOWN) {} | |
| 25 | |
| 26 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | |
| 27 const std::string& text, PermissionBubbleType bubble_type) | |
| 28 : MockPermissionBubbleRequest(text, | |
| 29 "button", | |
| 30 "button", | |
| 31 GURL("http://www.google.com"), | |
| 32 bubble_type) {} | |
| 33 | |
| 34 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | |
| 35 const std::string& text, | |
| 36 const GURL& url) | |
| 37 : MockPermissionBubbleRequest(text, | |
| 38 "button", | |
| 39 "button", | |
| 40 url, | |
| 41 PermissionBubbleType::UNKNOWN) {} | |
| 42 | |
| 43 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | |
| 44 const std::string& text, | |
| 45 const std::string& accept_label, | |
| 46 const std::string& deny_label) | |
| 47 : MockPermissionBubbleRequest(text, | |
| 48 accept_label, | |
| 49 deny_label, | |
| 50 GURL("http://www.google.com"), | |
| 51 PermissionBubbleType::UNKNOWN) {} | |
| 52 | |
| 53 MockPermissionBubbleRequest::~MockPermissionBubbleRequest() {} | |
| 54 | |
| 55 int MockPermissionBubbleRequest::GetIconId() const { | |
| 56 // Use a valid icon ID to support UI tests. | |
| 57 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; | |
| 58 } | |
| 59 | |
| 60 base::string16 MockPermissionBubbleRequest::GetMessageTextFragment() const { | |
| 61 return text_; | |
| 62 } | |
| 63 | |
| 64 GURL MockPermissionBubbleRequest::GetOrigin() const { | |
| 65 return origin_; | |
| 66 } | |
| 67 | |
| 68 void MockPermissionBubbleRequest::PermissionGranted() { | |
| 69 granted_ = true; | |
| 70 } | |
| 71 | |
| 72 void MockPermissionBubbleRequest::PermissionDenied() { | |
| 73 granted_ = false; | |
| 74 } | |
| 75 | |
| 76 void MockPermissionBubbleRequest::Cancelled() { | |
| 77 granted_ = false; | |
| 78 cancelled_ = true; | |
| 79 } | |
| 80 | |
| 81 void MockPermissionBubbleRequest::RequestFinished() { | |
| 82 finished_ = true; | |
| 83 } | |
| 84 | |
| 85 PermissionBubbleType MockPermissionBubbleRequest::GetPermissionBubbleType() | |
| 86 const { | |
| 87 return bubble_type_; | |
| 88 } | |
| 89 | |
| 90 bool MockPermissionBubbleRequest::granted() { | |
| 91 return granted_; | |
| 92 } | |
| 93 | |
| 94 bool MockPermissionBubbleRequest::cancelled() { | |
| 95 return cancelled_; | |
| 96 } | |
| 97 | |
| 98 bool MockPermissionBubbleRequest::finished() { | |
| 99 return finished_; | |
| 100 } | |
| 101 | |
| 102 MockPermissionBubbleRequest::MockPermissionBubbleRequest( | |
| 103 const std::string& text, | |
| 104 const std::string& accept_label, | |
| 105 const std::string& deny_label, | |
| 106 const GURL& origin, | |
| 107 PermissionBubbleType bubble_type) | |
| 108 : granted_(false), | |
| 109 cancelled_(false), | |
| 110 finished_(false), | |
| 111 bubble_type_(bubble_type) { | |
| 112 text_ = base::UTF8ToUTF16(text); | |
| 113 accept_label_ = base::UTF8ToUTF16(accept_label); | |
| 114 deny_label_ = base::UTF8ToUTF16(deny_label); | |
| 115 origin_ = origin.GetOrigin(); | |
| 116 } | |
| OLD | NEW |