summaryrefslogtreecommitdiffstats
path: root/chrome/test/remoting/page_load_notification_observer.h
blob: 42e3a6cbdd8b8aa2a1320238d0288351bae3fc74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2013 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_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_
#define CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_

#include "content/public/test/test_utils.h"
#include "url/gurl.h"

namespace remoting {

// A PageLoadNotificationObserver allows code to wait until a give URL is loaded
// in any tab in any browser window, i.e. NotificationService::AllSources().
// This simple pattern is not easy to implement using
// WindowedNotificationObserver because we need to bind the observer object
// in the callback but we also need to provide the callback when constructing
// the observer object.
class PageLoadNotificationObserver
    : public content::WindowedNotificationObserver {
 public:
  explicit PageLoadNotificationObserver(const GURL& target);

  virtual ~PageLoadNotificationObserver();

 private:
  bool IsTargetLoaded();
  GURL target_;
  DISALLOW_COPY_AND_ASSIGN(PageLoadNotificationObserver);
};

}  // namespace remoting

#endif  // CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_