| 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/media/midi_permission_context.h" | 5 #include "chrome/browser/media/midi_permission_context.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 TEST_F(MidiPermissionContextTests, TestInsecureRequestingUrl) { | 91 TEST_F(MidiPermissionContextTests, TestInsecureRequestingUrl) { |
| 92 TestPermissionContext permission_context(profile()); | 92 TestPermissionContext permission_context(profile()); |
| 93 GURL url("http://www.example.com"); | 93 GURL url("http://www.example.com"); |
| 94 content::WebContentsTester::For(web_contents())->NavigateAndCommit(url); | 94 content::WebContentsTester::For(web_contents())->NavigateAndCommit(url); |
| 95 | 95 |
| 96 const PermissionRequestID id( | 96 const PermissionRequestID id( |
| 97 web_contents()->GetRenderProcessHost()->GetID(), | 97 web_contents()->GetRenderProcessHost()->GetID(), |
| 98 web_contents()->GetMainFrame()->GetRoutingID(), | 98 web_contents()->GetMainFrame()->GetRoutingID(), |
| 99 -1); | 99 -1); |
| 100 permission_context.RequestPermission( | 100 permission_context.RequestPermission( |
| 101 web_contents(), id, url, | 101 web_contents(), |
| 102 id, url, true, |
| 102 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 103 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 103 base::Unretained(&permission_context))); | 104 base::Unretained(&permission_context))); |
| 104 | 105 |
| 105 EXPECT_TRUE(permission_context.permission_set()); | 106 EXPECT_TRUE(permission_context.permission_set()); |
| 106 EXPECT_FALSE(permission_context.permission_granted()); | 107 EXPECT_FALSE(permission_context.permission_granted()); |
| 107 EXPECT_TRUE(permission_context.tab_context_updated()); | 108 EXPECT_TRUE(permission_context.tab_context_updated()); |
| 108 | 109 |
| 109 ContentSetting setting = | 110 ContentSetting setting = |
| 110 HostContentSettingsMapFactory::GetForProfile(profile()) | 111 HostContentSettingsMapFactory::GetForProfile(profile()) |
| 111 ->GetContentSetting(url.GetOrigin(), | 112 ->GetContentSetting(url.GetOrigin(), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 139 ->GetContentSetting(insecure_url.GetOrigin(), | 140 ->GetContentSetting(insecure_url.GetOrigin(), |
| 140 secure_url.GetOrigin(), | 141 secure_url.GetOrigin(), |
| 141 CONTENT_SETTINGS_TYPE_MIDI_SYSEX, | 142 CONTENT_SETTINGS_TYPE_MIDI_SYSEX, |
| 142 std::string())); | 143 std::string())); |
| 143 | 144 |
| 144 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus( | 145 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus( |
| 145 insecure_url, insecure_url)); | 146 insecure_url, insecure_url)); |
| 146 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus( | 147 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus( |
| 147 insecure_url, secure_url)); | 148 insecure_url, secure_url)); |
| 148 } | 149 } |
| OLD | NEW |