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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 PermissionReporterBrowserTest() : SyncTest(SINGLE_CLIENT) {} | 36 PermissionReporterBrowserTest() : SyncTest(SINGLE_CLIENT) {} |
37 ~PermissionReporterBrowserTest() override {} | 37 ~PermissionReporterBrowserTest() override {} |
38 | 38 |
39 protected: | 39 protected: |
40 void SetUpOnMainThread() override { | 40 void SetUpOnMainThread() override { |
41 SyncTest::SetUpOnMainThread(); | 41 SyncTest::SetUpOnMainThread(); |
42 | 42 |
43 base::RunLoop run_loop; | 43 base::RunLoop run_loop; |
44 content::BrowserThread::PostTaskAndReply( | 44 content::BrowserThread::PostTaskAndReply( |
45 content::BrowserThread::IO, FROM_HERE, | 45 content::BrowserThread::IO, FROM_HERE, |
46 base::Bind( | 46 base::BindOnce( |
47 &PermissionReporterBrowserTest::AttachMockReportSenderOnIOThread, | 47 &PermissionReporterBrowserTest::AttachMockReportSenderOnIOThread, |
48 base::Unretained(this), | 48 base::Unretained(this), |
49 make_scoped_refptr(g_browser_process->safe_browsing_service())), | 49 make_scoped_refptr(g_browser_process->safe_browsing_service())), |
50 run_loop.QuitClosure()); | 50 run_loop.QuitClosure()); |
51 run_loop.Run(); | 51 run_loop.Run(); |
52 } | 52 } |
53 | 53 |
54 void AttachMockReportSenderOnIOThread( | 54 void AttachMockReportSenderOnIOThread( |
55 scoped_refptr<SafeBrowsingService> safe_browsing_service) { | 55 scoped_refptr<SafeBrowsingService> safe_browsing_service) { |
56 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 56 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 permission_report.platform_type()); | 191 permission_report.platform_type()); |
192 EXPECT_EQ(PermissionReport::NO_GESTURE, permission_report.gesture()); | 192 EXPECT_EQ(PermissionReport::NO_GESTURE, permission_report.gesture()); |
193 EXPECT_EQ(PermissionReport::PERSIST_DECISION_UNSPECIFIED, | 193 EXPECT_EQ(PermissionReport::PERSIST_DECISION_UNSPECIFIED, |
194 permission_report.persisted()); | 194 permission_report.persisted()); |
195 EXPECT_EQ(0, permission_report.num_prior_dismissals()); | 195 EXPECT_EQ(0, permission_report.num_prior_dismissals()); |
196 // Ensure that we correctly record one prior ignore. | 196 // Ensure that we correctly record one prior ignore. |
197 EXPECT_EQ(1, permission_report.num_prior_ignores()); | 197 EXPECT_EQ(1, permission_report.num_prior_ignores()); |
198 } | 198 } |
199 | 199 |
200 } // namespace safe_browsing | 200 } // namespace safe_browsing |
OLD | NEW |