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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/id_map.h" | 18 #include "base/id_map.h" |
19 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" |
20 #include "base/synchronization/waitable_event.h" | 21 #include "base/synchronization/waitable_event.h" |
21 #include "base/test/simple_test_clock.h" | 22 #include "base/test/simple_test_clock.h" |
22 #include "base/time/clock.h" | 23 #include "base/time/clock.h" |
23 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 25 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
25 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 26 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
26 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 27 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
27 #include "chrome/browser/infobars/infobar_service.h" | 28 #include "chrome/browser/infobars/infobar_service.h" |
28 #include "chrome/browser/permissions/permission_context_base.h" | 29 #include "chrome/browser/permissions/permission_context_base.h" |
29 #include "chrome/browser/permissions/permission_manager.h" | 30 #include "chrome/browser/permissions/permission_manager.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 ConfirmInfoBarDelegate* infobar_delegate = | 385 ConfirmInfoBarDelegate* infobar_delegate = |
385 infobar->delegate()->AsConfirmInfoBarDelegate(); | 386 infobar->delegate()->AsConfirmInfoBarDelegate(); |
386 infobar_delegate->Accept(); | 387 infobar_delegate->Accept(); |
387 #endif | 388 #endif |
388 } | 389 } |
389 | 390 |
390 base::string16 GeolocationPermissionContextTests::GetPromptText() { | 391 base::string16 GeolocationPermissionContextTests::GetPromptText() { |
391 #if !BUILDFLAG(ANDROID_JAVA_UI) | 392 #if !BUILDFLAG(ANDROID_JAVA_UI) |
392 PermissionBubbleManager* manager = | 393 PermissionBubbleManager* manager = |
393 PermissionBubbleManager::FromWebContents(web_contents()); | 394 PermissionBubbleManager::FromWebContents(web_contents()); |
394 return manager->requests_.front()->GetMessageText(); | 395 PermissionBubbleRequest* request = manager->requests_.front(); |
| 396 return base::ASCIIToUTF16(request->GetOrigin().spec()) + |
| 397 request->GetMessageTextFragment(); |
395 #else | 398 #else |
396 infobars::InfoBar* infobar = infobar_service()->infobar_at(0); | 399 infobars::InfoBar* infobar = infobar_service()->infobar_at(0); |
397 ConfirmInfoBarDelegate* infobar_delegate = | 400 ConfirmInfoBarDelegate* infobar_delegate = |
398 infobar->delegate()->AsConfirmInfoBarDelegate(); | 401 infobar->delegate()->AsConfirmInfoBarDelegate(); |
399 return infobar_delegate->GetMessageText(); | 402 return infobar_delegate->GetMessageText(); |
400 #endif | 403 #endif |
401 } | 404 } |
402 | 405 |
403 // Tests ---------------------------------------------------------------------- | 406 // Tests ---------------------------------------------------------------------- |
404 | 407 |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 // it is the embedder. | 977 // it is the embedder. |
975 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), | 978 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), |
976 requesting_frame_0.GetOrigin(), | 979 requesting_frame_0.GetOrigin(), |
977 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 980 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
978 13); | 981 13); |
979 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), | 982 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), |
980 requesting_frame_0.GetOrigin(), | 983 requesting_frame_0.GetOrigin(), |
981 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 984 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
982 11); | 985 11); |
983 } | 986 } |
OLD | NEW |