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

Side by Side Diff: chrome/browser/safe_browsing/permission_reporter_unittest.cc

Issue 2272793009: Permission Action Reporting: Fix upload url. (Closed)
Patch Set: Fix test as well Created 4 years, 3 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/safe_browsing/permission_reporter.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/safe_browsing/permission_reporter.h" 5 #include "chrome/browser/safe_browsing/permission_reporter.h"
6 6
7 #include "base/feature_list.h" 7 #include "base/feature_list.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/test/simple_test_clock.h" 10 #include "base/test/simple_test_clock.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "chrome/browser/permissions/permission_request.h" 12 #include "chrome/browser/permissions/permission_request.h"
13 #include "chrome/browser/safe_browsing/mock_permission_report_sender.h" 13 #include "chrome/browser/safe_browsing/mock_permission_report_sender.h"
14 #include "chrome/common/safe_browsing/permission_report.pb.h" 14 #include "chrome/common/safe_browsing/permission_report.pb.h"
15 #include "components/variations/active_field_trials.h" 15 #include "components/variations/active_field_trials.h"
16 #include "content/public/browser/permission_type.h" 16 #include "content/public/browser/permission_type.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 using content::PermissionType; 19 using content::PermissionType;
20 20
21 namespace safe_browsing { 21 namespace safe_browsing {
22 22
23 namespace { 23 namespace {
24 24
25 // URL to upload permission action reports. 25 // URL to upload permission action reports.
26 const char kPermissionActionReportingUploadUrl[] = 26 const char kPermissionActionReportingUploadUrl[] =
27 "http://safebrowsing.googleusercontent.com/safebrowsing/clientreport/" 27 "https://safebrowsing.googleusercontent.com/safebrowsing/clientreport/"
28 "permission-action"; 28 "chrome-permissions";
29 29
30 const int kMaximumReportsPerOriginPerPermissionPerMinute = 5; 30 const int kMaximumReportsPerOriginPerPermissionPerMinute = 5;
31 31
32 const char kDummyOriginOne[] = "http://example.test/"; 32 const char kDummyOriginOne[] = "http://example.test/";
33 const char kDummyOriginTwo[] = "http://example2.test/"; 33 const char kDummyOriginTwo[] = "http://example2.test/";
34 const PermissionType kDummyPermissionOne = PermissionType::GEOLOCATION; 34 const PermissionType kDummyPermissionOne = PermissionType::GEOLOCATION;
35 const PermissionType kDummyPermissionTwo = PermissionType::NOTIFICATIONS; 35 const PermissionType kDummyPermissionTwo = PermissionType::NOTIFICATIONS;
36 const PermissionAction kDummyAction = GRANTED; 36 const PermissionAction kDummyAction = GRANTED;
37 const PermissionSourceUI kDummySourceUI = PermissionSourceUI::PROMPT; 37 const PermissionSourceUI kDummySourceUI = PermissionSourceUI::PROMPT;
38 const PermissionRequestGestureType kDummyGestureType = 38 const PermissionRequestGestureType kDummyGestureType =
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 reports_to_send = 12; 205 reports_to_send = 12;
206 while (reports_to_send--) { 206 while (reports_to_send--) {
207 clock_->Advance(base::TimeDelta::FromSeconds(5)); 207 clock_->Advance(base::TimeDelta::FromSeconds(5));
208 permission_reporter_->SendReport(BuildDummyReportInfo()); 208 permission_reporter_->SendReport(BuildDummyReportInfo());
209 } 209 }
210 EXPECT_EQ(kMaximumReportsPerOriginPerPermissionPerMinute, 210 EXPECT_EQ(kMaximumReportsPerOriginPerPermissionPerMinute,
211 mock_report_sender_->GetAndResetNumberOfReportsSent()); 211 mock_report_sender_->GetAndResetNumberOfReportsSent());
212 } 212 }
213 213
214 } // namespace safe_browsing 214 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/permission_reporter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698