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

Side by Side Diff: chrome/browser/permissions/permission_queue_controller_unittest.cc

Issue 2154033003: Add gesture type value from infobar to permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-user-gesture-from-permission-layer-to-permission-report
Patch Set: nit Created 4 years, 4 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
« no previous file with comments | « chrome/browser/permissions/permission_queue_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/permissions/permission_queue_controller.h" 5 #include "chrome/browser/permissions/permission_queue_controller.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // maintain its registration for notifications with the helper, but on the 92 // maintain its registration for notifications with the helper, but on the
93 // last infobar cancellation it should unregister for notifications. 93 // last infobar cancellation it should unregister for notifications.
94 // 94 //
95 // What we don't want is for the controller to unregister and then re-register 95 // What we don't want is for the controller to unregister and then re-register
96 // for notifications, which can lead to getting notified multiple times. This 96 // for notifications, which can lead to getting notified multiple times. This
97 // test checks that in the case where the controller should remain registered 97 // test checks that in the case where the controller should remain registered
98 // for notifications, it gets notified exactly once." 98 // for notifications, it gets notified exactly once."
99 ObservationCountingQueueController queue_controller(profile()); 99 ObservationCountingQueueController queue_controller(profile());
100 GURL url("http://www.example.com/geolocation"); 100 GURL url("http://www.example.com/geolocation");
101 base::Callback<void(ContentSetting)> callback; 101 base::Callback<void(ContentSetting)> callback;
102 queue_controller.CreateInfoBarRequest( 102 queue_controller.CreateInfoBarRequest(RequestID(0), url, url,
103 RequestID(0), url, url, callback); 103 false /* user_gesture */, callback);
104 queue_controller.CreateInfoBarRequest( 104 queue_controller.CreateInfoBarRequest(RequestID(1), url, url,
105 RequestID(1), url, url, callback); 105 false /* user_gesture */, callback);
106 queue_controller.CancelInfoBarRequest(RequestID(0)); 106 queue_controller.CancelInfoBarRequest(RequestID(0));
107 EXPECT_EQ(1, queue_controller.call_count()); 107 EXPECT_EQ(1, queue_controller.call_count());
108 } 108 }
109 109
110 TEST_F(PermissionQueueControllerTests, FailOnBadPattern) { 110 TEST_F(PermissionQueueControllerTests, FailOnBadPattern) {
111 ObservationCountingQueueController queue_controller(profile()); 111 ObservationCountingQueueController queue_controller(profile());
112 GURL url("chrome://settings"); 112 GURL url("chrome://settings");
113 base::Callback<void(ContentSetting)> callback; 113 base::Callback<void(ContentSetting)> callback;
114 queue_controller.CreateInfoBarRequest( 114 queue_controller.CreateInfoBarRequest(RequestID(0), url, url,
115 RequestID(0), url, url, callback); 115 false /* user_gesture */, callback);
116 queue_controller.CancelInfoBarRequest(RequestID(0)); 116 queue_controller.CancelInfoBarRequest(RequestID(0));
117 EXPECT_EQ(0, queue_controller.call_count()); 117 EXPECT_EQ(0, queue_controller.call_count());
118 } 118 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_queue_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698