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

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

Issue 648653003: Standardize usage of virtual/override/final in chrome/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/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 "chrome/browser/content_settings/host_content_settings_map.h" 8 #include "chrome/browser/content_settings/host_content_settings_map.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"
(...skipping 24 matching lines...) Expand all
35 35
36 class TestPermissionContext : public PermissionContextBase { 36 class TestPermissionContext : public PermissionContextBase {
37 public: 37 public:
38 TestPermissionContext(Profile* profile, 38 TestPermissionContext(Profile* profile,
39 const ContentSettingsType permission_type) 39 const ContentSettingsType permission_type)
40 : PermissionContextBase(profile, permission_type), 40 : PermissionContextBase(profile, permission_type),
41 permission_set_(false), 41 permission_set_(false),
42 permission_granted_(false), 42 permission_granted_(false),
43 tab_context_updated_(false) {} 43 tab_context_updated_(false) {}
44 44
45 virtual ~TestPermissionContext() {} 45 ~TestPermissionContext() override {}
46 46
47 PermissionQueueController* GetInfoBarController() { 47 PermissionQueueController* GetInfoBarController() {
48 return GetQueueController(); 48 return GetQueueController();
49 } 49 }
50 50
51 bool permission_granted() { 51 bool permission_granted() {
52 return permission_granted_; 52 return permission_granted_;
53 } 53 }
54 54
55 bool permission_set() { 55 bool permission_set() {
56 return permission_set_; 56 return permission_set_;
57 } 57 }
58 58
59 bool tab_context_updated() { 59 bool tab_context_updated() {
60 return tab_context_updated_; 60 return tab_context_updated_;
61 } 61 }
62 62
63 void TrackPermissionDecision(bool granted) { 63 void TrackPermissionDecision(bool granted) {
64 permission_set_ = true; 64 permission_set_ = true;
65 permission_granted_ = granted; 65 permission_granted_ = granted;
66 } 66 }
67 67
68 protected: 68 protected:
69 virtual void UpdateTabContext(const PermissionRequestID& id, 69 void UpdateTabContext(const PermissionRequestID& id,
70 const GURL& requesting_origin, 70 const GURL& requesting_origin,
71 bool allowed) override { 71 bool allowed) override {
72 tab_context_updated_ = true; 72 tab_context_updated_ = true;
73 } 73 }
74 74
75 private: 75 private:
76 bool permission_set_; 76 bool permission_set_;
77 bool permission_granted_; 77 bool permission_granted_;
78 bool tab_context_updated_; 78 bool tab_context_updated_;
79 }; 79 };
80 80
81 // Simulates clicking Accept. The permission should be granted and 81 // Simulates clicking Accept. The permission should be granted and
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 EXPECT_TRUE(permission_context.permission_set()); 132 EXPECT_TRUE(permission_context.permission_set());
133 EXPECT_FALSE(permission_context.permission_granted()); 133 EXPECT_FALSE(permission_context.permission_granted());
134 EXPECT_TRUE(permission_context.tab_context_updated()); 134 EXPECT_TRUE(permission_context.tab_context_updated());
135 135
136 ContentSetting setting = 136 ContentSetting setting =
137 profile()->GetHostContentSettingsMap()->GetContentSetting( 137 profile()->GetHostContentSettingsMap()->GetContentSetting(
138 url.GetOrigin(), url.GetOrigin(), 138 url.GetOrigin(), url.GetOrigin(),
139 CONTENT_SETTINGS_TYPE_MIDI_SYSEX, std::string()); 139 CONTENT_SETTINGS_TYPE_MIDI_SYSEX, std::string());
140 EXPECT_EQ(CONTENT_SETTING_ASK , setting); 140 EXPECT_EQ(CONTENT_SETTING_ASK , setting);
141 }; 141 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698