#ifndef CHROME_TEST_CHROMEDRIVER_CHROME_NAVIGATION_TRACKER_H_
#define CHROME_TEST_CHROMEDRIVER_CHROME_NAVIGATION_TRACKER_H_
#include <set>
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
#include "chrome/test/chromedriver/chrome/status.h"
namespace base {
class DictionaryValue;
}
class DevToolsClient;
class Status;
class NavigationTracker : public DevToolsEventListener {
public:
enum LoadingState {
kUnknown,
kLoading,
kNotLoading,
};
NavigationTracker(DevToolsClient* client, int build_no);
NavigationTracker(DevToolsClient* client,
LoadingState known_state,
int build_no);
virtual ~NavigationTracker();
Status IsPendingNavigation(const std::string& frame_id, bool* is_pending);
virtual Status OnConnected(DevToolsClient* client) OVERRIDE;
virtual Status OnEvent(DevToolsClient* client,
const std::string& method,
const base::DictionaryValue& params) OVERRIDE;
virtual Status OnCommandSuccess(DevToolsClient* client,
const std::string& method) OVERRIDE;
private:
DevToolsClient* client_;
LoadingState loading_state_;
int build_no_;
int num_frames_pending_;
std::set<std::string> scheduled_frame_set_;
void ResetLoadingState(LoadingState loading_state);
DISALLOW_COPY_AND_ASSIGN(NavigationTracker);
};
#endif