1 // Copyright (c) 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.
5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_NAVIGATION_TRACKER_H_
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_NAVIGATION_TRACKER_H_
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
14 #include "chrome/test/chromedriver/chrome/status.h"
17 class DictionaryValue;
23 // Tracks the navigation state of the page.
24 class NavigationTracker : public DevToolsEventListener {
32 explicit NavigationTracker(DevToolsClient* client);
33 NavigationTracker(DevToolsClient* client, LoadingState known_state);
34 virtual ~NavigationTracker();
36 // Gets whether a navigation is pending for the specified frame. |frame_id|
37 // may be empty to signify the main frame.
38 Status IsPendingNavigation(const std::string& frame_id, bool* is_pending);
40 // Overridden from DevToolsEventListener:
41 virtual Status OnConnected(DevToolsClient* client) OVERRIDE;
42 virtual Status OnEvent(DevToolsClient* client,
43 const std::string& method,
44 const base::DictionaryValue& params) OVERRIDE;
45 virtual Status OnCommandSuccess(DevToolsClient* client,
46 const std::string& method) OVERRIDE;
49 DevToolsClient* client_;
50 LoadingState loading_state_;
51 std::set<std::string> scheduled_frame_set_;
53 DISALLOW_COPY_AND_ASSIGN(NavigationTracker);
56 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_NAVIGATION_TRACKER_H_