| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/content_settings/permission_queue_controller.h" | 5 #include "chrome/browser/content_settings/permission_queue_controller.h" |
| 6 | 6 |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/content_settings/permission_request_id.h" | 9 #include "chrome/browser/content_settings/permission_request_id.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class PermissionQueueControllerTests : public ChromeRenderViewHostTestHarness { | 22 class PermissionQueueControllerTests : public ChromeRenderViewHostTestHarness { |
| 23 protected: | 23 protected: |
| 24 PermissionQueueControllerTests() {} | 24 PermissionQueueControllerTests() {} |
| 25 virtual ~PermissionQueueControllerTests() {} | 25 virtual ~PermissionQueueControllerTests() {} |
| 26 | 26 |
| 27 PermissionRequestID RequestID(int bridge_id) { | 27 PermissionRequestID RequestID(int bridge_id) { |
| 28 return PermissionRequestID( | 28 return PermissionRequestID( |
| 29 web_contents()->GetRenderProcessHost()->GetID(), | 29 web_contents()->GetRenderProcessHost()->GetID(), |
| 30 web_contents()->GetRenderViewHost()->GetRoutingID(), | 30 web_contents()->GetRenderViewHost()->GetRoutingID(), |
| 31 bridge_id); | 31 bridge_id, |
| 32 0); |
| 32 } | 33 } |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 // ChromeRenderViewHostTestHarness: | 36 // ChromeRenderViewHostTestHarness: |
| 36 virtual void SetUp() OVERRIDE { | 37 virtual void SetUp() OVERRIDE { |
| 37 ChromeRenderViewHostTestHarness::SetUp(); | 38 ChromeRenderViewHostTestHarness::SetUp(); |
| 38 InfoBarService::CreateForWebContents(web_contents()); | 39 InfoBarService::CreateForWebContents(web_contents()); |
| 39 } | 40 } |
| 40 | 41 |
| 41 DISALLOW_COPY_AND_ASSIGN(PermissionQueueControllerTests); | 42 DISALLOW_COPY_AND_ASSIGN(PermissionQueueControllerTests); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // test checks that in the case where the controller should remain registered | 95 // test checks that in the case where the controller should remain registered |
| 95 // for notifications, it gets notified exactly once." | 96 // for notifications, it gets notified exactly once." |
| 96 ObservationCountingQueueController queue_controller(profile()); | 97 ObservationCountingQueueController queue_controller(profile()); |
| 97 GURL url("http://www.example.com/geolocation"); | 98 GURL url("http://www.example.com/geolocation"); |
| 98 base::Callback<void(bool)> callback; | 99 base::Callback<void(bool)> callback; |
| 99 queue_controller.CreateInfoBarRequest(RequestID(0), url, url, callback); | 100 queue_controller.CreateInfoBarRequest(RequestID(0), url, url, callback); |
| 100 queue_controller.CreateInfoBarRequest(RequestID(1), url, url, callback); | 101 queue_controller.CreateInfoBarRequest(RequestID(1), url, url, callback); |
| 101 queue_controller.CancelInfoBarRequest(RequestID(0)); | 102 queue_controller.CancelInfoBarRequest(RequestID(0)); |
| 102 EXPECT_EQ(1, queue_controller.call_count()); | 103 EXPECT_EQ(1, queue_controller.call_count()); |
| 103 }; | 104 }; |
| OLD | NEW |