| OLD | NEW |
| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/test/scoped_feature_list.h" | 9 #include "base/test/scoped_feature_list.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 "components/safe_browsing/common/permission_report.pb.h" |
| 15 #include "components/variations/active_field_trials.h" | 15 #include "components/variations/active_field_trials.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace safe_browsing { | 18 namespace safe_browsing { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // URL to upload permission action reports. | 22 // URL to upload permission action reports. |
| 23 const char kPermissionActionReportingUploadUrl[] = | 23 const char kPermissionActionReportingUploadUrl[] = |
| 24 "https://safebrowsing.googleusercontent.com/safebrowsing/clientreport/" | 24 "https://safebrowsing.googleusercontent.com/safebrowsing/clientreport/" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 reports_to_send = 12; | 209 reports_to_send = 12; |
| 210 while (reports_to_send--) { | 210 while (reports_to_send--) { |
| 211 clock_->Advance(base::TimeDelta::FromSeconds(5)); | 211 clock_->Advance(base::TimeDelta::FromSeconds(5)); |
| 212 permission_reporter_->SendReport(BuildDummyReportInfo()); | 212 permission_reporter_->SendReport(BuildDummyReportInfo()); |
| 213 } | 213 } |
| 214 EXPECT_EQ(kMaximumReportsPerOriginPerPermissionPerMinute, | 214 EXPECT_EQ(kMaximumReportsPerOriginPerPermissionPerMinute, |
| 215 mock_report_sender_->GetAndResetNumberOfReportsSent()); | 215 mock_report_sender_->GetAndResetNumberOfReportsSent()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace safe_browsing | 218 } // namespace safe_browsing |
| OLD | NEW |