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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/content_settings/host_content_settings_map_unittest.h
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.h b/chrome/browser/content_settings/host_content_settings_map_unittest.h
new file mode 100644
index 0000000000000000000000000000000000000000..ba56ab4d8cdff87495f0b101d2e2057cb805e6f1
--- /dev/null
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_UNITTEST_H_
+#define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_UNITTEST_H_
+#pragma once
+
+#include "chrome/browser/content_settings/content_settings_details.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/common/notification_service.h"
+#include "googleurl/src/gurl.h"
+
+class HostContentSettingsMap;
+
+class StubSettingsObserver : public NotificationObserver {
+ public:
+ StubSettingsObserver() : last_notifier(NULL), counter(0) {
+ registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED,
+ NotificationService::AllSources());
+ }
+
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ ++counter;
+ Source<HostContentSettingsMap> content_settings(source);
+ Details<ContentSettingsDetails> settings_details(details);
+ last_notifier = content_settings.ptr();
+ last_pattern = settings_details.ptr()->pattern();
+ last_update_all = settings_details.ptr()->update_all();
+ last_update_all_types = settings_details.ptr()->update_all_types();
+ last_type = settings_details.ptr()->type();
+ // This checks that calling a Get function from an observer doesn't
+ // deadlock.
+ last_notifier->GetContentSettings(GURL("http://random-hostname.com/"));
+ }
+
+ HostContentSettingsMap* last_notifier;
+ ContentSettingsPattern last_pattern;
+ bool last_update_all;
+ bool last_update_all_types;
+ int counter;
+ ContentSettingsType last_type;
+
+ private:
+ NotificationRegistrar registrar_;
+};
+#endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_UNITTEST_H_

Powered by Google App Engine
This is Rietveld 408576698