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

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

Issue 2358723002: Convert FieldTrialList to Accept a std::unique_ptr (Closed)
Patch Set: Change Comment nullptr to null Created 4 years, 3 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
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/permissions/permission_context_base.h" 5 #include "chrome/browser/permissions/permission_context_base.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/feature_list.h" 11 #include "base/feature_list.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
14 #include "base/test/histogram_tester.h" 15 #include "base/test/histogram_tester.h"
15 #include "base/test/mock_entropy_provider.h" 16 #include "base/test/mock_entropy_provider.h"
16 #include "base/test/scoped_feature_list.h" 17 #include "base/test/scoped_feature_list.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 19 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
19 #include "chrome/browser/infobars/infobar_service.h" 20 #include "chrome/browser/infobars/infobar_service.h"
20 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" 21 #include "chrome/browser/permissions/permission_decision_auto_blocker.h"
21 #include "chrome/browser/permissions/permission_queue_controller.h" 22 #include "chrome/browser/permissions/permission_queue_controller.h"
22 #include "chrome/browser/permissions/permission_request_id.h" 23 #include "chrome/browser/permissions/permission_request_id.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 }; 100 };
100 101
101 class TestKillSwitchPermissionContext : public TestPermissionContext { 102 class TestKillSwitchPermissionContext : public TestPermissionContext {
102 public: 103 public:
103 TestKillSwitchPermissionContext( 104 TestKillSwitchPermissionContext(
104 Profile* profile, 105 Profile* profile,
105 const content::PermissionType permission_type, 106 const content::PermissionType permission_type,
106 const ContentSettingsType content_settings_type) 107 const ContentSettingsType content_settings_type)
107 : TestPermissionContext(profile, permission_type, content_settings_type), 108 : TestPermissionContext(profile, permission_type, content_settings_type),
108 field_trial_list_( 109 field_trial_list_(
109 new base::FieldTrialList(new base::MockEntropyProvider)) {} 110 new base::FieldTrialList(
111 base::MakeUnique<base::MockEntropyProvider>())) {}
110 112
111 void ResetFieldTrialList() { 113 void ResetFieldTrialList() {
112 // Destroy the existing FieldTrialList before creating a new one to avoid 114 // Destroy the existing FieldTrialList before creating a new one to avoid
113 // a DCHECK. 115 // a DCHECK.
114 field_trial_list_.reset(); 116 field_trial_list_.reset();
115 field_trial_list_.reset(new base::FieldTrialList( 117 field_trial_list_.reset(new base::FieldTrialList(
116 new base::MockEntropyProvider)); 118 base::MakeUnique<base::MockEntropyProvider>()));
117 variations::testing::ClearAllVariationParams(); 119 variations::testing::ClearAllVariationParams();
118 } 120 }
119 121
120 private: 122 private:
121 std::unique_ptr<base::FieldTrialList> field_trial_list_; 123 std::unique_ptr<base::FieldTrialList> field_trial_list_;
122 }; 124 };
123 125
124 class PermissionContextBaseTests : public ChromeRenderViewHostTestHarness { 126 class PermissionContextBaseTests : public ChromeRenderViewHostTestHarness {
125 protected: 127 protected:
126 PermissionContextBaseTests() {} 128 PermissionContextBaseTests() {}
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 TestParallelRequests(CONTENT_SETTING_ALLOW); 656 TestParallelRequests(CONTENT_SETTING_ALLOW);
655 } 657 }
656 658
657 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) { 659 TEST_F(PermissionContextBaseTests, TestParallelRequestsBlocked) {
658 TestParallelRequests(CONTENT_SETTING_BLOCK); 660 TestParallelRequests(CONTENT_SETTING_BLOCK);
659 } 661 }
660 662
661 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) { 663 TEST_F(PermissionContextBaseTests, TestParallelRequestsDismissed) {
662 TestParallelRequests(CONTENT_SETTING_ASK); 664 TestParallelRequests(CONTENT_SETTING_ASK);
663 } 665 }
OLDNEW
« no previous file with comments | « chrome/browser/memory/tab_manager_unittest.cc ('k') | chrome/browser/predictors/resource_prefetch_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698