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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 private: | 76 private: |
77 // Owned by permission reporter. | 77 // Owned by permission reporter. |
78 MockPermissionReportSender* mock_report_sender_; | 78 MockPermissionReportSender* mock_report_sender_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(PermissionReporterBrowserTest); | 80 DISALLOW_COPY_AND_ASSIGN(PermissionReporterBrowserTest); |
81 }; | 81 }; |
82 | 82 |
83 // Test that permission action report will be sent if the user is opted into it. | 83 // Test that permission action report will be sent if the user is opted into it. |
84 IN_PROC_BROWSER_TEST_F(PermissionReporterBrowserTest, | 84 IN_PROC_BROWSER_TEST_F(PermissionReporterBrowserTest, |
85 DISABLED_PermissionActionReporting) { | 85 PermissionActionReporting) { |
86 // Set up the Sync client. | 86 // Set up the Sync client. |
87 ASSERT_TRUE(SetupSync()); | 87 ASSERT_TRUE(SetupSync()); |
88 Profile* profile = GetProfile(0); | 88 Profile* profile = GetProfile(0); |
89 Browser* browser = CreateBrowser(profile); | 89 Browser* browser = CreateBrowser(profile); |
90 | 90 |
91 // Set up mock permission manager and prompt factory. | 91 // Set up mock permission manager and prompt factory. |
92 PermissionRequestManager* manager = GetPermissionRequestManager(browser); | 92 PermissionRequestManager* manager = GetPermissionRequestManager(browser); |
93 std::unique_ptr<MockPermissionPromptFactory> mock_permission_prompt_factory = | 93 std::unique_ptr<MockPermissionPromptFactory> mock_permission_prompt_factory = |
94 base::MakeUnique<MockPermissionPromptFactory>(manager); | 94 base::MakeUnique<MockPermissionPromptFactory>(manager); |
95 manager->DisplayPendingRequests(); | 95 manager->DisplayPendingRequests(); |
(...skipping 23 matching lines...) Expand all Loading... |
119 EXPECT_EQ(PermissionReport::DESKTOP_PLATFORM, | 119 EXPECT_EQ(PermissionReport::DESKTOP_PLATFORM, |
120 permission_report.platform_type()); | 120 permission_report.platform_type()); |
121 EXPECT_EQ(PermissionReport::NO_GESTURE, permission_report.gesture()); | 121 EXPECT_EQ(PermissionReport::NO_GESTURE, permission_report.gesture()); |
122 EXPECT_EQ(PermissionReport::PERSIST_DECISION_UNSPECIFIED, | 122 EXPECT_EQ(PermissionReport::PERSIST_DECISION_UNSPECIFIED, |
123 permission_report.persisted()); | 123 permission_report.persisted()); |
124 EXPECT_EQ(0, permission_report.num_prior_dismissals()); | 124 EXPECT_EQ(0, permission_report.num_prior_dismissals()); |
125 EXPECT_EQ(0, permission_report.num_prior_ignores()); | 125 EXPECT_EQ(0, permission_report.num_prior_ignores()); |
126 } | 126 } |
127 | 127 |
128 IN_PROC_BROWSER_TEST_F(PermissionReporterBrowserTest, | 128 IN_PROC_BROWSER_TEST_F(PermissionReporterBrowserTest, |
129 DISABLED_PermissionActionReportingPriorIgnoreCount) { | 129 PermissionActionReportingPriorIgnoreCount) { |
130 // Set up the Sync client. | 130 // Set up the Sync client. |
131 ASSERT_TRUE(SetupSync()); | 131 ASSERT_TRUE(SetupSync()); |
132 Profile* profile = GetProfile(0); | 132 Profile* profile = GetProfile(0); |
133 Browser* browser = CreateBrowser(profile); | 133 Browser* browser = CreateBrowser(profile); |
134 | 134 |
135 // Set up mock permission manager and prompt factory. | 135 // Set up mock permission manager and prompt factory. |
136 PermissionRequestManager* manager = GetPermissionRequestManager(browser); | 136 PermissionRequestManager* manager = GetPermissionRequestManager(browser); |
137 std::unique_ptr<MockPermissionPromptFactory> mock_permission_prompt_factory = | 137 std::unique_ptr<MockPermissionPromptFactory> mock_permission_prompt_factory = |
138 base::MakeUnique<MockPermissionPromptFactory>(manager); | 138 base::MakeUnique<MockPermissionPromptFactory>(manager); |
139 manager->DisplayPendingRequests(); | 139 manager->DisplayPendingRequests(); |
(...skipping 51 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 |