page_load_notification_observer.h revision 8bcbed890bc3ce4d7a057a8f32cab53fa534672e
1// Copyright 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_ 6#define CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_ 7 8#include "content/public/test/test_utils.h" 9#include "url/gurl.h" 10 11namespace remoting { 12 13// A PageLoadNotificationObserver allows code to wait until a give URL is loaded 14// in any tab in any browser window, i.e. NotificationService::AllSources(). 15// This simple pattern is not easy to implement using 16// WindowedNotificationObserver because we need to bind the observer object 17// in the callback but we also need to provide the callback when constructing 18// the observer object. 19class PageLoadNotificationObserver 20 : public content::WindowedNotificationObserver { 21 public: 22 explicit PageLoadNotificationObserver(const GURL& target); 23 24 virtual ~PageLoadNotificationObserver(); 25 26 private: 27 bool IsTargetLoaded(); 28 GURL target_; 29 DISALLOW_COPY_AND_ASSIGN(PageLoadNotificationObserver); 30}; 31 32} // namespace remoting 33 34#endif // CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_ 35