| 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 "chrome/browser/content_settings/permission_queue_controller.h" | 8 #include "chrome/browser/content_settings/permission_queue_controller.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 10 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 // Web MIDI permission should be denied for insecure origin. | 85 // Web MIDI permission should be denied for insecure origin. |
| 86 TEST_F(MidiPermissionContextTests, TestInsecureRequestingUrl) { | 86 TEST_F(MidiPermissionContextTests, TestInsecureRequestingUrl) { |
| 87 TestPermissionContext permission_context(profile()); | 87 TestPermissionContext permission_context(profile()); |
| 88 GURL url("http://www.example.com"); | 88 GURL url("http://www.example.com"); |
| 89 content::WebContentsTester::For(web_contents())->NavigateAndCommit(url); | 89 content::WebContentsTester::For(web_contents())->NavigateAndCommit(url); |
| 90 | 90 |
| 91 const PermissionRequestID id( | 91 const PermissionRequestID id( |
| 92 web_contents()->GetRenderProcessHost()->GetID(), | 92 web_contents()->GetRenderProcessHost()->GetID(), |
| 93 web_contents()->GetRenderViewHost()->GetRoutingID(), | 93 web_contents()->GetMainFrame()->GetRoutingID(), |
| 94 -1, GURL()); | 94 -1, GURL()); |
| 95 permission_context.RequestPermission( | 95 permission_context.RequestPermission( |
| 96 web_contents(), | 96 web_contents(), |
| 97 id, url, true, | 97 id, url, true, |
| 98 base::Bind(&TestPermissionContext::TrackPermissionDecision, | 98 base::Bind(&TestPermissionContext::TrackPermissionDecision, |
| 99 base::Unretained(&permission_context))); | 99 base::Unretained(&permission_context))); |
| 100 | 100 |
| 101 EXPECT_TRUE(permission_context.permission_set()); | 101 EXPECT_TRUE(permission_context.permission_set()); |
| 102 EXPECT_FALSE(permission_context.permission_granted()); | 102 EXPECT_FALSE(permission_context.permission_granted()); |
| 103 EXPECT_TRUE(permission_context.tab_context_updated()); | 103 EXPECT_TRUE(permission_context.tab_context_updated()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 127 EXPECT_EQ(CONTENT_SETTING_ASK, | 127 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 128 profile()->GetHostContentSettingsMap()->GetContentSetting( | 128 profile()->GetHostContentSettingsMap()->GetContentSetting( |
| 129 insecure_url.GetOrigin(), secure_url.GetOrigin(), | 129 insecure_url.GetOrigin(), secure_url.GetOrigin(), |
| 130 CONTENT_SETTINGS_TYPE_MIDI_SYSEX, std::string())); | 130 CONTENT_SETTINGS_TYPE_MIDI_SYSEX, std::string())); |
| 131 | 131 |
| 132 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus( | 132 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus( |
| 133 insecure_url, insecure_url)); | 133 insecure_url, insecure_url)); |
| 134 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus( | 134 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus( |
| 135 insecure_url, secure_url)); | 135 insecure_url, secure_url)); |
| 136 } | 136 } |
| OLD | NEW |