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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
13 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 13 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
14 #include "chrome/browser/content_settings/host_content_settings_map.h" | 14 #include "chrome/browser/content_settings/host_content_settings_map.h" |
15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
16 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" | 16 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
| 17 #include "chrome/browser/geolocation/chrome_geolocation_permission_context_facto
ry.h" |
17 #include "chrome/browser/infobars/infobar.h" | 18 #include "chrome/browser/infobars/infobar.h" |
18 #include "chrome/browser/infobars/infobar_tab_helper.h" | 19 #include "chrome/browser/infobars/infobar_tab_helper.h" |
19 #include "chrome/browser/view_type_utils.h" | 20 #include "chrome/browser/view_type_utils.h" |
20 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 22 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
22 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
23 #include "content/public/browser/navigation_details.h" | 24 #include "content/public/browser/navigation_details.h" |
24 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
25 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 void GeolocationPermissionContextTests::SetUp() { | 249 void GeolocationPermissionContextTests::SetUp() { |
249 db_thread_.Start(); | 250 db_thread_.Start(); |
250 ChromeRenderViewHostTestHarness::SetUp(); | 251 ChromeRenderViewHostTestHarness::SetUp(); |
251 | 252 |
252 // Set up required helpers, and make this be as "tabby" as the code requires. | 253 // Set up required helpers, and make this be as "tabby" as the code requires. |
253 chrome::SetViewType(web_contents(), chrome::VIEW_TYPE_TAB_CONTENTS); | 254 chrome::SetViewType(web_contents(), chrome::VIEW_TYPE_TAB_CONTENTS); |
254 InfoBarTabHelper::CreateForWebContents(web_contents()); | 255 InfoBarTabHelper::CreateForWebContents(web_contents()); |
255 TabSpecificContentSettings::CreateForWebContents(web_contents()); | 256 TabSpecificContentSettings::CreateForWebContents(web_contents()); |
256 | 257 |
257 geolocation_permission_context_ = | 258 geolocation_permission_context_ = |
258 ChromeGeolocationPermissionContext::Create(profile()); | 259 ChromeGeolocationPermissionContextFactory::Create(profile()); |
259 } | 260 } |
260 | 261 |
261 void GeolocationPermissionContextTests::TearDown() { | 262 void GeolocationPermissionContextTests::TearDown() { |
262 extra_tabs_.clear(); | 263 extra_tabs_.clear(); |
263 ChromeRenderViewHostTestHarness::TearDown(); | 264 ChromeRenderViewHostTestHarness::TearDown(); |
264 // Schedule another task on the DB thread to notify us that it's safe to | 265 // Schedule another task on the DB thread to notify us that it's safe to |
265 // carry on with the test. | 266 // carry on with the test. |
266 base::WaitableEvent done(false, false); | 267 base::WaitableEvent done(false, false); |
267 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 268 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
268 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); | 269 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 ASSERT_FALSE(infobar_0->ShouldExpire(details)); | 651 ASSERT_FALSE(infobar_0->ShouldExpire(details)); |
651 // Commit the "GoBack()" above, and ensure the infobar is now expired. | 652 // Commit the "GoBack()" above, and ensure the infobar is now expired. |
652 WebContentsTester::For(web_contents())->CommitPendingNavigation(); | 653 WebContentsTester::For(web_contents())->CommitPendingNavigation(); |
653 details.entry = web_contents()->GetController().GetLastCommittedEntry(); | 654 details.entry = web_contents()->GetController().GetLastCommittedEntry(); |
654 ASSERT_TRUE(infobar_0->ShouldExpire(details)); | 655 ASSERT_TRUE(infobar_0->ShouldExpire(details)); |
655 | 656 |
656 // Delete the tab contents. | 657 // Delete the tab contents. |
657 DeleteContents(); | 658 DeleteContents(); |
658 infobar_0->InfoBarClosed(); | 659 infobar_0->InfoBarClosed(); |
659 } | 660 } |
OLD | NEW |