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_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_BROWSERTEST_H_
6#define CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_BROWSERTEST_H_
7
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "chrome/test/base/web_ui_browser_test.h"
11#include "content/public/browser/web_ui_message_handler.h"
12
13// This is a helper class used by options_browsertest.js to feed the navigation
14// history back to the test.
15class OptionsBrowserTest : public WebUIBrowserTest,
16                           public content::WebUIMessageHandler {
17 public:
18  OptionsBrowserTest();
19  virtual ~OptionsBrowserTest();
20
21 protected:
22  // Clears the preference at the given |path|.
23  void ClearPref(const char* path);
24
25 private:
26  // WebUIMessageHandler implementation.
27  virtual void RegisterMessages() OVERRIDE;
28
29  // WebUIBrowserTest implementation.
30  virtual content::WebUIMessageHandler* GetMockMessageHandler() OVERRIDE;
31
32  // A callback for the 'optionsTestReportHistory' message, this sends the
33  // URLs in the "back" tab history, including the current entry, back to the
34  // WebUI via a callback.
35  void ReportHistory(const base::ListValue* list_value);
36
37  // A callback for the 'optionsTestSetPref' message. The first argument should
38  // be a pref path (e.g., "profile.managed_users"); the second, the new value
39  // to set for that pref.
40  void HandleSetPref(const base::ListValue* args);
41
42  DISALLOW_COPY_AND_ASSIGN(OptionsBrowserTest);
43};
44
45#endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_OPTIONS_BROWSERTEST_H_
46