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

Side by Side Diff: chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc

Issue 23345004: Fix Android strict-mode violation in GeoLocation info bar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments / fix tests Created 6 years, 9 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 unified diff | Download patch
OLDNEW
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 "chrome/browser/geolocation/chrome_geolocation_permission_context.h" 5 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "base/run_loop.h"
14 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
15 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/content_settings/host_content_settings_map.h" 17 #include "chrome/browser/content_settings/host_content_settings_map.h"
17 #include "chrome/browser/content_settings/permission_request_id.h" 18 #include "chrome/browser/content_settings/permission_request_id.h"
18 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 19 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
19 #include "chrome/browser/geolocation/chrome_geolocation_permission_context_facto ry.h" 20 #include "chrome/browser/geolocation/chrome_geolocation_permission_context_facto ry.h"
20 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 21 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
21 #include "chrome/browser/infobars/infobar.h" 22 #include "chrome/browser/infobars/infobar.h"
22 #include "chrome/browser/infobars/infobar_service.h" 23 #include "chrome/browser/infobars/infobar_service.h"
23 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 24 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
24 #include "chrome/test/base/testing_profile.h" 25 #include "chrome/test/base/testing_profile.h"
26 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/navigation_details.h" 27 #include "content/public/browser/navigation_details.h"
26 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
27 #include "content/public/browser/notification_service.h" 29 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
29 #include "content/public/test/mock_render_process_host.h" 31 #include "content/public/test/mock_render_process_host.h"
30 #include "content/public/test/test_renderer_host.h" 32 #include "content/public/test/test_renderer_host.h"
31 #include "content/public/test/web_contents_tester.h" 33 #include "content/public/test/web_contents_tester.h"
32 #include "extensions/browser/view_type_utils.h" 34 #include "extensions/browser/view_type_utils.h"
33 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
34 36
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 156 }
155 157
156 void GeolocationPermissionContextTests::RequestGeolocationPermission( 158 void GeolocationPermissionContextTests::RequestGeolocationPermission(
157 const PermissionRequestID& id, 159 const PermissionRequestID& id,
158 const GURL& requesting_frame) { 160 const GURL& requesting_frame) {
159 geolocation_permission_context_->RequestGeolocationPermission( 161 geolocation_permission_context_->RequestGeolocationPermission(
160 id.render_process_id(), id.render_view_id(), id.bridge_id(), 162 id.render_process_id(), id.render_view_id(), id.bridge_id(),
161 requesting_frame, 163 requesting_frame,
162 base::Bind(&GeolocationPermissionContextTests::PermissionResponse, 164 base::Bind(&GeolocationPermissionContextTests::PermissionResponse,
163 base::Unretained(this), id)); 165 base::Unretained(this), id));
166 content::BrowserThread::GetBlockingPool()->FlushForTesting();
167 base::RunLoop().RunUntilIdle();
164 } 168 }
165 169
166 void GeolocationPermissionContextTests::CancelGeolocationPermissionRequest( 170 void GeolocationPermissionContextTests::CancelGeolocationPermissionRequest(
167 const PermissionRequestID& id, 171 const PermissionRequestID& id,
168 const GURL& requesting_frame) { 172 const GURL& requesting_frame) {
169 geolocation_permission_context_->CancelGeolocationPermissionRequest( 173 geolocation_permission_context_->CancelGeolocationPermissionRequest(
170 id.render_process_id(), id.render_view_id(), id.bridge_id(), 174 id.render_process_id(), id.render_view_id(), id.bridge_id(),
171 requesting_frame); 175 requesting_frame);
172 } 176 }
173 177
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 content::LoadCommittedDetails details; 674 content::LoadCommittedDetails details;
671 details.entry = web_contents()->GetController().GetLastCommittedEntry(); 675 details.entry = web_contents()->GetController().GetLastCommittedEntry();
672 EXPECT_FALSE(infobar_delegate->ShouldExpire(details)); 676 EXPECT_FALSE(infobar_delegate->ShouldExpire(details));
673 // Ensure the infobar will expire when we commit the pending navigation. 677 // Ensure the infobar will expire when we commit the pending navigation.
674 details.entry = web_contents()->GetController().GetActiveEntry(); 678 details.entry = web_contents()->GetController().GetActiveEntry();
675 EXPECT_TRUE(infobar_delegate->ShouldExpire(details)); 679 EXPECT_TRUE(infobar_delegate->ShouldExpire(details));
676 680
677 // Delete the tab contents. 681 // Delete the tab contents.
678 DeleteContents(); 682 DeleteContents();
679 } 683 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698