| 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 "chrome/browser/geolocation/geolocation_permission_context.h" | 5 #include "chrome/browser/geolocation/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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | 25 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 27 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 28 #include "chrome/test/base/testing_profile.h" | 28 #include "chrome/test/base/testing_profile.h" |
| 29 #include "components/content_settings/core/browser/host_content_settings_map.h" | 29 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 30 #include "components/content_settings/core/common/permission_request_id.h" | 30 #include "components/content_settings/core/common/permission_request_id.h" |
| 31 #include "components/infobars/core/confirm_infobar_delegate.h" | 31 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 32 #include "components/infobars/core/infobar.h" | 32 #include "components/infobars/core/infobar.h" |
| 33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/navigation_details.h" | 34 #include "content/public/browser/navigation_details.h" |
| 35 #include "content/public/browser/navigation_entry.h" | |
| 36 #include "content/public/browser/notification_observer.h" | 35 #include "content/public/browser/notification_observer.h" |
| 37 #include "content/public/browser/notification_registrar.h" | 36 #include "content/public/browser/notification_registrar.h" |
| 38 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
| 39 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 40 #include "content/public/test/mock_render_process_host.h" | 39 #include "content/public/test/mock_render_process_host.h" |
| 41 #include "content/public/test/test_renderer_host.h" | 40 #include "content/public/test/test_renderer_host.h" |
| 42 #include "content/public/test/test_utils.h" | 41 #include "content/public/test/test_utils.h" |
| 43 #include "content/public/test/web_contents_tester.h" | 42 #include "content/public/test/web_contents_tester.h" |
| 44 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
| 45 | 44 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 ASSERT_EQ(responses_.count(process->GetID()), 1U); | 217 ASSERT_EQ(responses_.count(process->GetID()), 1U); |
| 219 EXPECT_EQ(bridge_id, responses_[process->GetID()].first); | 218 EXPECT_EQ(bridge_id, responses_[process->GetID()].first); |
| 220 EXPECT_EQ(allowed, responses_[process->GetID()].second); | 219 EXPECT_EQ(allowed, responses_[process->GetID()].second); |
| 221 responses_.erase(process->GetID()); | 220 responses_.erase(process->GetID()); |
| 222 } | 221 } |
| 223 | 222 |
| 224 void GeolocationPermissionContextTests::AddNewTab(const GURL& url) { | 223 void GeolocationPermissionContextTests::AddNewTab(const GURL& url) { |
| 225 content::WebContents* new_tab = CreateTestWebContents(); | 224 content::WebContents* new_tab = CreateTestWebContents(); |
| 226 new_tab->GetController().LoadURL( | 225 new_tab->GetController().LoadURL( |
| 227 url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 226 url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| 228 content::NavigationEntry* entry = new_tab->GetController().GetPendingEntry(); | |
| 229 content::RenderFrameHostTester::For(new_tab->GetMainFrame()) | 227 content::RenderFrameHostTester::For(new_tab->GetMainFrame()) |
| 230 ->SendNavigate(extra_tabs_.size() + 1, entry->GetUniqueID(), true, url); | 228 ->SendNavigate(extra_tabs_.size() + 1, url); |
| 231 | 229 |
| 232 // Set up required helpers, and make this be as "tabby" as the code requires. | 230 // Set up required helpers, and make this be as "tabby" as the code requires. |
| 233 #if defined(ENABLE_EXTENSIONS) | 231 #if defined(ENABLE_EXTENSIONS) |
| 234 extensions::SetViewType(new_tab, extensions::VIEW_TYPE_TAB_CONTENTS); | 232 extensions::SetViewType(new_tab, extensions::VIEW_TYPE_TAB_CONTENTS); |
| 235 #endif | 233 #endif |
| 236 InfoBarService::CreateForWebContents(new_tab); | 234 InfoBarService::CreateForWebContents(new_tab); |
| 237 PermissionBubbleManager::CreateForWebContents(new_tab); | 235 PermissionBubbleManager::CreateForWebContents(new_tab); |
| 238 PermissionBubbleManager::FromWebContents(new_tab)->SetView(&bubble_view_); | 236 PermissionBubbleManager::FromWebContents(new_tab)->SetView(&bubble_view_); |
| 239 | 237 |
| 240 extra_tabs_.push_back(new_tab); | 238 extra_tabs_.push_back(new_tab); |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 13); | 969 13); |
| 972 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), | 970 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), |
| 973 requesting_frame_0.GetOrigin(), | 971 requesting_frame_0.GetOrigin(), |
| 974 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 972 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
| 975 11); | 973 11); |
| 976 } | 974 } |
| 977 | 975 |
| 978 INSTANTIATE_TEST_CASE_P(GeolocationPermissionContextTestsWithAndWithoutBubbles, | 976 INSTANTIATE_TEST_CASE_P(GeolocationPermissionContextTestsWithAndWithoutBubbles, |
| 979 GeolocationPermissionContextParamTests, | 977 GeolocationPermissionContextParamTests, |
| 980 ::testing::Values(false, true)); | 978 ::testing::Values(false, true)); |
| OLD | NEW |