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

Side by Side Diff: chrome/browser/media/midi_permission_context_unittest.cc

Issue 1422053004: permissions: remove PermissionQueueController and introduce PermissionInfoBarManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address small issues Created 5 years, 1 month 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
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/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/host_content_settings_map_factory.h" 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
9 #include "chrome/browser/infobars/infobar_service.h"
10 #include "chrome/browser/permissions/permission_infobar_manager.h"
9 #include "chrome/browser/permissions/permission_request_id.h" 11 #include "chrome/browser/permissions/permission_request_id.h"
10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 12 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
11 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
12 #include "components/content_settings/core/browser/host_content_settings_map.h" 14 #include "components/content_settings/core/browser/host_content_settings_map.h"
13 #include "components/content_settings/core/common/content_settings.h" 15 #include "components/content_settings/core/common/content_settings.h"
14 #include "components/content_settings/core/common/content_settings_types.h" 16 #include "components/content_settings/core/common/content_settings_types.h"
15 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
16 #include "content/public/test/mock_render_process_host.h" 18 #include "content/public/test/mock_render_process_host.h"
17 #include "content/public/test/web_contents_tester.h" 19 #include "content/public/test/web_contents_tester.h"
18 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 class MidiPermissionContextTests : public ChromeRenderViewHostTestHarness { 72 class MidiPermissionContextTests : public ChromeRenderViewHostTestHarness {
71 protected: 73 protected:
72 MidiPermissionContextTests() = default; 74 MidiPermissionContextTests() = default;
73 75
74 private: 76 private:
75 // ChromeRenderViewHostTestHarness: 77 // ChromeRenderViewHostTestHarness:
76 void SetUp() override { 78 void SetUp() override {
77 ChromeRenderViewHostTestHarness::SetUp(); 79 ChromeRenderViewHostTestHarness::SetUp();
78 #if defined(OS_ANDROID) 80 #if defined(OS_ANDROID)
79 InfoBarService::CreateForWebContents(web_contents()); 81 InfoBarService::CreateForWebContents(web_contents());
82 PermissionInfoBarManager::CreateForWebContents(web_contents());
80 #else 83 #else
81 PermissionBubbleManager::CreateForWebContents(web_contents()); 84 PermissionBubbleManager::CreateForWebContents(web_contents());
82 #endif 85 #endif
83 } 86 }
84 87
85 DISALLOW_COPY_AND_ASSIGN(MidiPermissionContextTests); 88 DISALLOW_COPY_AND_ASSIGN(MidiPermissionContextTests);
86 }; 89 };
87 90
88 // Web MIDI permission should be denied for insecure origin. 91 // Web MIDI permission should be denied for insecure origin.
89 TEST_F(MidiPermissionContextTests, TestInsecureRequestingUrl) { 92 TEST_F(MidiPermissionContextTests, TestInsecureRequestingUrl) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 ->GetContentSetting(insecure_url.GetOrigin(), 141 ->GetContentSetting(insecure_url.GetOrigin(),
139 secure_url.GetOrigin(), 142 secure_url.GetOrigin(),
140 CONTENT_SETTINGS_TYPE_MIDI_SYSEX, 143 CONTENT_SETTINGS_TYPE_MIDI_SYSEX,
141 std::string())); 144 std::string()));
142 145
143 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus( 146 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus(
144 insecure_url, insecure_url)); 147 insecure_url, insecure_url));
145 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus( 148 EXPECT_EQ(CONTENT_SETTING_BLOCK, permission_context.GetPermissionStatus(
146 insecure_url, secure_url)); 149 insecure_url, secure_url));
147 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698