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

Unified Diff: content/public/test/test_utils.cc

Issue 24261010: Allow explicitly whitelisted apps/extensions in public sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix handing of guest user ID. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/test_utils.h ('k') | net/base/url_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/test_utils.cc
diff --git a/content/public/test/test_utils.cc b/content/public/test/test_utils.cc
index 92c6fdcb66f798999717c9e92fd544b61a6ca601..989437cf8a3ff41feb4fcb6eb555efc583348971 100644
--- a/content/public/test/test_utils.cc
+++ b/content/public/test/test_utils.cc
@@ -67,6 +67,17 @@ void ScriptCallback::ResultCallback(const base::Value* result) {
base::MessageLoop::current()->Quit();
}
+// Adapter that makes a WindowedNotificationObserver::ConditionTestCallback from
+// a WindowedNotificationObserver::ConditionTestCallbackWithoutSourceAndDetails
+// by ignoring the notification source and details.
+bool IgnoreSourceAndDetails(
+ const WindowedNotificationObserver::
+ ConditionTestCallbackWithoutSourceAndDetails& callback,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ return callback.Run();
+}
+
} // namespace
void RunMessageLoop() {
@@ -186,6 +197,16 @@ WindowedNotificationObserver::WindowedNotificationObserver(
AddNotificationType(notification_type, source_);
}
+WindowedNotificationObserver::WindowedNotificationObserver(
+ int notification_type,
+ const ConditionTestCallbackWithoutSourceAndDetails& callback)
+ : seen_(false),
+ running_(false),
+ callback_(base::Bind(&IgnoreSourceAndDetails, callback)),
+ source_(NotificationService::AllSources()) {
+ registrar_.Add(this, notification_type, source_);
+}
+
WindowedNotificationObserver::~WindowedNotificationObserver() {}
void WindowedNotificationObserver::AddNotificationType(
@@ -210,7 +231,7 @@ void WindowedNotificationObserver::Observe(
const NotificationDetails& details) {
source_ = source;
details_ = details;
- if (!callback_.is_null() && !callback_.Run())
+ if (!callback_.is_null() && !callback_.Run(source, details))
return;
seen_ = true;
« no previous file with comments | « content/public/test/test_utils.h ('k') | net/base/url_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698