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