| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/permissions/permission_manager.h" | 5 #include "chrome/browser/permissions/permission_manager.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 10 #include "chrome/browser/permissions/permission_manager_factory.h" | 10 #include "chrome/browser/permissions/permission_manager_factory.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 GetHostContentSettingsMap()->SetContentSettingDefaultScope( | 295 GetHostContentSettingsMap()->SetContentSettingDefaultScope( |
| 296 url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string(), | 296 url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string(), |
| 297 CONTENT_SETTING_ASK); | 297 CONTENT_SETTING_ASK); |
| 298 | 298 |
| 299 EXPECT_TRUE(callback_called()); | 299 EXPECT_TRUE(callback_called()); |
| 300 EXPECT_EQ(PermissionStatus::ASK, callback_result()); | 300 EXPECT_EQ(PermissionStatus::ASK, callback_result()); |
| 301 | 301 |
| 302 GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id); | 302 GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id); |
| 303 } | 303 } |
| 304 |
| 305 TEST_F(PermissionManagerTest, SubscribeMIDIPermission) { |
| 306 int subscription_id = GetPermissionManager()->SubscribePermissionStatusChange( |
| 307 PermissionType::MIDI, url(), url(), |
| 308 base::Bind(&PermissionManagerTest::OnPermissionChange, |
| 309 base::Unretained(this))); |
| 310 |
| 311 CheckPermissionStatus(PermissionType::GEOLOCATION, PermissionStatus::ASK); |
| 312 GetHostContentSettingsMap()->SetContentSettingDefaultScope( |
| 313 url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string(), |
| 314 CONTENT_SETTING_ALLOW); |
| 315 CheckPermissionStatus(PermissionType::GEOLOCATION, PermissionStatus::GRANTED); |
| 316 |
| 317 EXPECT_FALSE(callback_called()); |
| 318 |
| 319 GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id); |
| 320 } |
| OLD | NEW |