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

Side by Side Diff: chrome/browser/content_settings/host_content_settings_map_unittest.h

Issue 5528010: Implement preference and policy based content settings providers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/content_settings
Patch Set: updates Created 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_UNITTEST_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_UNITTEST_H_
7 #pragma once
8
9 #include "chrome/browser/content_settings/content_settings_details.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h"
11 #include "chrome/common/notification_service.h"
12 #include "googleurl/src/gurl.h"
13
14 class HostContentSettingsMap;
15
16 class StubSettingsObserver : public NotificationObserver {
17 public:
18 StubSettingsObserver() : last_notifier(NULL), counter(0) {
19 registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED,
20 NotificationService::AllSources());
21 }
22
23 virtual void Observe(NotificationType type,
24 const NotificationSource& source,
25 const NotificationDetails& details) {
26 ++counter;
27 Source<HostContentSettingsMap> content_settings(source);
28 Details<ContentSettingsDetails> settings_details(details);
29 last_notifier = content_settings.ptr();
30 last_pattern = settings_details.ptr()->pattern();
31 last_update_all = settings_details.ptr()->update_all();
32 last_update_all_types = settings_details.ptr()->update_all_types();
33 last_type = settings_details.ptr()->type();
34 // This checks that calling a Get function from an observer doesn't
35 // deadlock.
36 last_notifier->GetContentSettings(GURL("http://random-hostname.com/"));
37 }
38
39 HostContentSettingsMap* last_notifier;
40 ContentSettingsPattern last_pattern;
41 bool last_update_all;
42 bool last_update_all_types;
43 int counter;
44 ContentSettingsType last_type;
45
46 private:
47 NotificationRegistrar registrar_;
48 };
49 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698