Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(932)

Unified Diff: chrome/browser/geolocation/geolocation_infobar_queue_controller_unittest.cc

Issue 11269002: Introduce GeolocationPermissionRequestID, a wrapper struct to contain the (render process ID, rende… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/geolocation/geolocation_infobar_queue_controller_unittest.cc
===================================================================
--- chrome/browser/geolocation/geolocation_infobar_queue_controller_unittest.cc (revision 163741)
+++ chrome/browser/geolocation/geolocation_infobar_queue_controller_unittest.cc (working copy)
@@ -4,6 +4,7 @@
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h"
+#include "chrome/browser/geolocation/geolocation_permission_request_id.h"
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
@@ -18,8 +19,7 @@
GeolocationInfoBarQueueControllerTests();
protected:
- int ProcessId();
- int RenderId();
+ GeolocationPermissionRequestID RequestID(int bridge_id);
private:
// ChromeRenderViewHostTestHarness:
@@ -34,14 +34,14 @@
: ui_thread_(content::BrowserThread::UI, MessageLoop::current()) {
}
-int GeolocationInfoBarQueueControllerTests::ProcessId() {
- return web_contents()->GetRenderProcessHost()->GetID();
+GeolocationPermissionRequestID
+ GeolocationInfoBarQueueControllerTests::RequestID(int bridge_id) {
+ return GeolocationPermissionRequestID(
+ web_contents()->GetRenderProcessHost()->GetID(),
+ web_contents()->GetRenderViewHost()->GetRoutingID(),
+ bridge_id);
}
-int GeolocationInfoBarQueueControllerTests::RenderId() {
- return web_contents()->GetRenderViewHost()->GetRoutingID();
-}
-
void GeolocationInfoBarQueueControllerTests::SetUp() {
ChromeRenderViewHostTestHarness::SetUp();
InfoBarTabHelper::CreateForWebContents(web_contents());
@@ -62,9 +62,7 @@
const content::NotificationSource& source,
const content::NotificationDetails& details);
- static void NotifyPermissionSet(int render_process_id,
- int render_view_id,
- int bridge_id,
+ static void NotifyPermissionSet(const GeolocationPermissionRequestID& id,
const GURL& requesting_frame,
base::Callback<void(bool)> callback,
bool allowed);
@@ -86,9 +84,7 @@
}
void ObservationCountingQueueController::NotifyPermissionSet(
- int render_process_id,
- int render_view_id,
- int bridge_id,
+ const GeolocationPermissionRequestID& id,
const GURL& requesting_frame,
base::Callback<void(bool)> callback,
bool allowed) {
@@ -110,10 +106,10 @@
ObservationCountingQueueController infobar_queue_controller(profile());
GURL url("http://www.example.com/geolocation");
base::Callback<void(bool)> callback;
- infobar_queue_controller.CreateInfoBarRequest(ProcessId(), RenderId(), 1,
- url, url, callback);
- infobar_queue_controller.CreateInfoBarRequest(ProcessId(), RenderId(), 2,
- url, url, callback);
- infobar_queue_controller.CancelInfoBarRequest(ProcessId(), RenderId(), 1);
+ infobar_queue_controller.CreateInfoBarRequest(RequestID(0), url, url,
+ callback);
+ infobar_queue_controller.CreateInfoBarRequest(RequestID(1), url, url,
+ callback);
+ infobar_queue_controller.CancelInfoBarRequest(RequestID(0));
EXPECT_EQ(1, infobar_queue_controller.call_count());
};

Powered by Google App Engine
This is Rietveld 408576698