Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: chrome/browser/permissions/permission_manager_unittest.cc

Issue 1885823002: Fix bug: MIDI causes crash on onContentSettingChanged() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove {} Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/permissions/permission_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698