| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 std::unique_ptr<MockPermissionPromptFactory> mock_permission_prompt_factory_; | 95 std::unique_ptr<MockPermissionPromptFactory> mock_permission_prompt_factory_; |
| 96 | 96 |
| 97 // Owned by permission reporter. | 97 // Owned by permission reporter. |
| 98 MockPermissionReportSender* mock_report_sender_; | 98 MockPermissionReportSender* mock_report_sender_; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 // Test that permission action report will be sent if the user is opted into it. | 101 // Test that permission action report will be sent if the user is opted into it. |
| 102 IN_PROC_BROWSER_TEST_F(PermissionReporterBrowserTest, | 102 IN_PROC_BROWSER_TEST_F(PermissionReporterBrowserTest, |
| 103 PermissionActionReporting) { | 103 DISABLED_PermissionActionReporting) { |
| 104 ASSERT_TRUE(embedded_test_server()->Start()); | 104 ASSERT_TRUE(embedded_test_server()->Start()); |
| 105 | 105 |
| 106 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 106 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 107 browser(), embedded_test_server()->GetURL("/permissions/request.html"), | 107 browser(), embedded_test_server()->GetURL("/permissions/request.html"), |
| 108 1); | 108 1); |
| 109 | 109 |
| 110 prompt_factory()->WaitForPermissionBubble(); | 110 prompt_factory()->WaitForPermissionBubble(); |
| 111 EXPECT_TRUE(prompt_factory()->is_visible()); | 111 EXPECT_TRUE(prompt_factory()->is_visible()); |
| 112 | 112 |
| 113 AcceptBubble(); | 113 AcceptBubble(); |
| 114 | 114 |
| 115 EXPECT_FALSE(prompt_factory()->is_visible()); | 115 EXPECT_FALSE(prompt_factory()->is_visible()); |
| 116 EXPECT_EQ(1, mock_report_sender()->GetAndResetNumberOfReportsSent()); | 116 EXPECT_EQ(1, mock_report_sender()->GetAndResetNumberOfReportsSent()); |
| 117 | 117 |
| 118 PermissionReport permission_report; | 118 PermissionReport permission_report; |
| 119 ASSERT_TRUE( | 119 ASSERT_TRUE( |
| 120 permission_report.ParseFromString(mock_report_sender()->latest_report())); | 120 permission_report.ParseFromString(mock_report_sender()->latest_report())); |
| 121 EXPECT_EQ(PermissionReport::GEOLOCATION, permission_report.permission()); | 121 EXPECT_EQ(PermissionReport::GEOLOCATION, permission_report.permission()); |
| 122 EXPECT_EQ(PermissionReport::GRANTED, permission_report.action()); | 122 EXPECT_EQ(PermissionReport::GRANTED, permission_report.action()); |
| 123 EXPECT_EQ(embedded_test_server()->base_url().spec(), | 123 EXPECT_EQ(embedded_test_server()->base_url().spec(), |
| 124 permission_report.origin()); | 124 permission_report.origin()); |
| 125 EXPECT_EQ(PermissionReport::DESKTOP_PLATFORM, | 125 EXPECT_EQ(PermissionReport::DESKTOP_PLATFORM, |
| 126 permission_report.platform_type()); | 126 permission_report.platform_type()); |
| 127 EXPECT_EQ(PermissionReport::NO_GESTURE, permission_report.gesture()); | 127 EXPECT_EQ(PermissionReport::NO_GESTURE, permission_report.gesture()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace safe_browsing | 130 } // namespace safe_browsing |
| OLD | NEW |