OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/synchronization/waitable_event.h" | 5 #include "base/synchronization/waitable_event.h" |
6 #include "chrome/browser/api/infobars/infobar_service.h" | 6 #include "chrome/browser/api/infobars/infobar_service.h" |
7 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h" | 7 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h" |
8 #include "chrome/browser/geolocation/geolocation_permission_request_id.h" | 8 #include "chrome/browser/geolocation/geolocation_permission_request_id.h" |
9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 explicit ObservationCountingQueueController(Profile* profile); | 53 explicit ObservationCountingQueueController(Profile* profile); |
54 | 54 |
55 int call_count() const { return call_count_; } | 55 int call_count() const { return call_count_; } |
56 | 56 |
57 private: | 57 private: |
58 int call_count_; | 58 int call_count_; |
59 | 59 |
60 // GeolocationInfoBarQueueController | 60 // GeolocationInfoBarQueueController |
61 virtual void Observe(int type, | 61 virtual void Observe(int type, |
62 const content::NotificationSource& source, | 62 const content::NotificationSource& source, |
63 const content::NotificationDetails& details); | 63 const content::NotificationDetails& details) OVERRIDE; |
64 | 64 |
65 static void NotifyPermissionSet(const GeolocationPermissionRequestID& id, | 65 static void NotifyPermissionSet(const GeolocationPermissionRequestID& id, |
66 const GURL& requesting_frame, | 66 const GURL& requesting_frame, |
67 base::Callback<void(bool)> callback, | 67 base::Callback<void(bool)> callback, |
68 bool allowed); | 68 bool allowed); |
69 }; | 69 }; |
70 | 70 |
71 ObservationCountingQueueController::ObservationCountingQueueController( | 71 ObservationCountingQueueController::ObservationCountingQueueController( |
72 Profile* profile) | 72 Profile* profile) |
73 : GeolocationInfoBarQueueController( | 73 : GeolocationInfoBarQueueController( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 ObservationCountingQueueController infobar_queue_controller(profile()); | 106 ObservationCountingQueueController infobar_queue_controller(profile()); |
107 GURL url("http://www.example.com/geolocation"); | 107 GURL url("http://www.example.com/geolocation"); |
108 base::Callback<void(bool)> callback; | 108 base::Callback<void(bool)> callback; |
109 infobar_queue_controller.CreateInfoBarRequest(RequestID(0), url, url, | 109 infobar_queue_controller.CreateInfoBarRequest(RequestID(0), url, url, |
110 callback); | 110 callback); |
111 infobar_queue_controller.CreateInfoBarRequest(RequestID(1), url, url, | 111 infobar_queue_controller.CreateInfoBarRequest(RequestID(1), url, url, |
112 callback); | 112 callback); |
113 infobar_queue_controller.CancelInfoBarRequest(RequestID(0)); | 113 infobar_queue_controller.CancelInfoBarRequest(RequestID(0)); |
114 EXPECT_EQ(1, infobar_queue_controller.call_count()); | 114 EXPECT_EQ(1, infobar_queue_controller.call_count()); |
115 }; | 115 }; |
OLD | NEW |