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

Unified Diff: content/public/test/repeated_notification_observer.h

Issue 2798143004: Fix for URL opening code (Closed)
Patch Set: Fixed class name usage. Created 3 years, 6 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
Index: content/public/test/repeated_notification_observer.h
diff --git a/content/public/test/repeated_notification_observer.h b/content/public/test/repeated_notification_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..5e96dfaf84a3ee0acc409e394a0b86cb1e40f1ea
--- /dev/null
+++ b/content/public/test/repeated_notification_observer.h
@@ -0,0 +1,39 @@
+// Copyright 2017 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 CONTENT_PUBLIC_TEST_REPEATED_NOTIFICATION_OBSERVER_H_
+#define CONTENT_PUBLIC_TEST_REPEATED_NOTIFICATION_OBSERVER_H_
+
+#include "base/run_loop.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+
+namespace content {
+
+// RepeatedNotificationObserver allows code to wait until specified number
+// of notifications of particular type are posted.
+class RepeatedNotificationObserver : public NotificationObserver {
+ public:
+ RepeatedNotificationObserver(int type, int count);
+
+ // NotificationObserver:
+ void Observe(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) override;
+
+ // Wait until |count| events of |type| (both specified in constructor) happen.
+ void Wait();
+
+ private:
+ int num_outstanding_;
+ NotificationRegistrar registrar_;
+ bool running_;
+ base::RunLoop run_loop_;
+
+ DISALLOW_COPY_AND_ASSIGN(RepeatedNotificationObserver);
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_TEST_REPEATED_NOTIFICATION_OBSERVER_H_
« no previous file with comments | « chrome/browser/sessions/session_restore_browsertest.cc ('k') | content/public/test/repeated_notification_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698