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

Side by Side Diff: chrome/browser/content_settings/permission_context_base_unittest.cc

Issue 812823002: Remove dependency of infobars component on the embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests by instanciating a TestConfirmInfoBarDelegateFactory Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/content_settings/permission_context_base.h" 5 #include "chrome/browser/content_settings/permission_context_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/content_settings/permission_queue_controller.h" 9 #include "chrome/browser/content_settings/permission_queue_controller.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 11 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 13 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
14 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
15 #include "components/content_settings/core/browser/host_content_settings_map.h" 15 #include "components/content_settings/core/browser/host_content_settings_map.h"
16 #include "components/content_settings/core/common/content_settings.h" 16 #include "components/content_settings/core/common/content_settings.h"
17 #include "components/content_settings/core/common/content_settings_types.h" 17 #include "components/content_settings/core/common/content_settings_types.h"
18 #include "components/content_settings/core/common/permission_request_id.h" 18 #include "components/content_settings/core/common/permission_request_id.h"
19 #include "components/infobars/test/test_confirm_infobar_delegate_factory.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "content/public/test/mock_render_process_host.h" 21 #include "content/public/test/mock_render_process_host.h"
21 #include "content/public/test/web_contents_tester.h" 22 #include "content/public/test/web_contents_tester.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 24
24 class TestPermissionContext : public PermissionContextBase { 25 class TestPermissionContext : public PermissionContextBase {
25 public: 26 public:
26 TestPermissionContext(Profile* profile, 27 TestPermissionContext(Profile* profile,
27 const ContentSettingsType permission_type) 28 const ContentSettingsType permission_type)
28 : PermissionContextBase(profile, permission_type), 29 : PermissionContextBase(profile, permission_type),
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 155 }
155 156
156 private: 157 private:
157 // ChromeRenderViewHostTestHarness: 158 // ChromeRenderViewHostTestHarness:
158 virtual void SetUp() override { 159 virtual void SetUp() override {
159 ChromeRenderViewHostTestHarness::SetUp(); 160 ChromeRenderViewHostTestHarness::SetUp();
160 InfoBarService::CreateForWebContents(web_contents()); 161 InfoBarService::CreateForWebContents(web_contents());
161 PermissionBubbleManager::CreateForWebContents(web_contents()); 162 PermissionBubbleManager::CreateForWebContents(web_contents());
162 } 163 }
163 164
165 TestConfirmInfoBarDelegateFactory confirm_info_bar_delegate_factory_;
166
164 DISALLOW_COPY_AND_ASSIGN(PermissionContextBaseTests); 167 DISALLOW_COPY_AND_ASSIGN(PermissionContextBaseTests);
165 }; 168 };
166 169
167 // Simulates clicking Accept. The permission should be granted and 170 // Simulates clicking Accept. The permission should be granted and
168 // saved for future use. 171 // saved for future use.
169 TEST_F(PermissionContextBaseTests, TestAskAndGrant) { 172 TEST_F(PermissionContextBaseTests, TestAskAndGrant) {
170 TestAskAndGrant_TestContent(); 173 TestAskAndGrant_TestContent();
171 StartUsingPermissionBubble(); 174 StartUsingPermissionBubble();
172 TestAskAndGrant_TestContent(); 175 TestAskAndGrant_TestContent();
173 }; 176 };
174 177
175 // Simulates clicking Dismiss (X) in the infobar/bubble. 178 // Simulates clicking Dismiss (X) in the infobar/bubble.
176 // The permission should be denied but not saved for future use. 179 // The permission should be denied but not saved for future use.
177 TEST_F(PermissionContextBaseTests, TestAskAndDismiss) { 180 TEST_F(PermissionContextBaseTests, TestAskAndDismiss) {
178 TestAskAndDismiss_TestContent(); 181 TestAskAndDismiss_TestContent();
179 StartUsingPermissionBubble(); 182 StartUsingPermissionBubble();
180 TestAskAndDismiss_TestContent(); 183 TestAskAndDismiss_TestContent();
181 }; 184 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698