| 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/test/simple_test_clock.h" | 10 #include "base/test/simple_test_clock.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 SigninManagerFactory::GetForProfile(browser()->profile()); | 54 SigninManagerFactory::GetForProfile(browser()->profile()); |
| 55 signin_manager->SetAuthenticatedAccountInfo("gaia_id", "fake_username"); | 55 signin_manager->SetAuthenticatedAccountInfo("gaia_id", "fake_username"); |
| 56 #endif | 56 #endif |
| 57 } | 57 } |
| 58 | 58 |
| 59 void TearDownOnMainThread() override { | 59 void TearDownOnMainThread() override { |
| 60 InProcessBrowserTest::TearDownOnMainThread(); | 60 InProcessBrowserTest::TearDownOnMainThread(); |
| 61 mock_permission_prompt_factory_.reset(); | 61 mock_permission_prompt_factory_.reset(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void SetUpCommandLine(base::CommandLine* command_line) override { | |
| 65 command_line->AppendSwitch(switches::kEnablePermissionActionReporting); | |
| 66 } | |
| 67 | |
| 68 void AttachMockReportSenderOnIOThread( | 64 void AttachMockReportSenderOnIOThread( |
| 69 scoped_refptr<SafeBrowsingService> safe_browsing_service) { | 65 scoped_refptr<SafeBrowsingService> safe_browsing_service) { |
| 70 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 66 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 71 | 67 |
| 72 mock_report_sender_ = new MockPermissionReportSender; | 68 mock_report_sender_ = new MockPermissionReportSender; |
| 73 | 69 |
| 74 safe_browsing_service->ping_manager()->permission_reporter_.reset( | 70 safe_browsing_service->ping_manager()->permission_reporter_.reset( |
| 75 new PermissionReporter(base::WrapUnique(mock_report_sender_), | 71 new PermissionReporter(base::WrapUnique(mock_report_sender_), |
| 76 base::WrapUnique(new base::SimpleTestClock))); | 72 base::WrapUnique(new base::SimpleTestClock))); |
| 77 } | 73 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 EXPECT_EQ(PermissionReport::DESKTOP_PLATFORM, | 123 EXPECT_EQ(PermissionReport::DESKTOP_PLATFORM, |
| 128 permission_report.platform_type()); | 124 permission_report.platform_type()); |
| 129 EXPECT_EQ(PermissionReport::NO_GESTURE, permission_report.gesture()); | 125 EXPECT_EQ(PermissionReport::NO_GESTURE, permission_report.gesture()); |
| 130 EXPECT_EQ(PermissionReport::PERSIST_DECISION_UNSPECIFIED, | 126 EXPECT_EQ(PermissionReport::PERSIST_DECISION_UNSPECIFIED, |
| 131 permission_report.persisted()); | 127 permission_report.persisted()); |
| 132 EXPECT_EQ(0, permission_report.num_prior_dismissals()); | 128 EXPECT_EQ(0, permission_report.num_prior_dismissals()); |
| 133 EXPECT_EQ(0, permission_report.num_prior_ignores()); | 129 EXPECT_EQ(0, permission_report.num_prior_ignores()); |
| 134 } | 130 } |
| 135 | 131 |
| 136 } // namespace safe_browsing | 132 } // namespace safe_browsing |
| OLD | NEW |