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