Chromium Code Reviews| 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..d7827f1c0b14be19919632afb8bd7c1760a76c3f |
| --- /dev/null |
| +++ b/content/public/test/repeated_notification_observer.h |
| @@ -0,0 +1,36 @@ |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
|
sky
2017/06/08 19:17:49
no (c) (see style guide).
eugenebng
2017/06/09 13:16:22
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_PUBLIC_BROWSER_REPEATED_NOTIFICATION_OBSERVER_H_ |
|
sky
2017/06/08 19:17:49
guard doesn't match file name.
eugenebng
2017/06/09 13:16:22
Done.
|
| +#define CONTENT_PUBLIC_BROWSER_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: |
| + explicit RepeatedNotificationObserver(int type, int count); |
|
sky
2017/06/08 19:17:49
no explicit
eugenebng
2017/06/09 13:16:22
Done.
|
| + |
| + void Observe(int type, |
|
sky
2017/06/08 19:17:49
Prefix with where override comes from, e.g.
// Not
eugenebng
2017/06/09 13:16:22
Done.
|
| + const NotificationSource& source, |
| + const NotificationDetails& details) override; |
| + void Wait(); |
|
sky
2017/06/08 19:17:49
Add description.
eugenebng
2017/06/09 13:16:22
Done.
|
| + |
| + private: |
| + int num_outstanding_; |
| + NotificationRegistrar registrar_; |
| + bool running_; |
| + base::RunLoop run_loop_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RepeatedNotificationObserver); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_PUBLIC_BROWSER_REPEATED_NOTIFICATION_OBSERVER_H_ |