Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / webui / web_ui_test_handler.h
blob11f3a3b5ae658e4a90dc5c6dc8cdae0dc7843b10
1 // Copyright (c) 2011 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_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "base/strings/string16.h"
10 #include "content/public/browser/web_ui_message_handler.h"
12 namespace base {
13 class ListValue;
14 class Value;
17 namespace content {
18 class RenderViewHost;
21 // This class registers test framework specific handlers on WebUI objects.
22 class WebUITestHandler : public content::WebUIMessageHandler {
23 public:
24 WebUITestHandler();
26 // Sends a message through |preload_host| with the |js_text| to preload at the
27 // appropriate time before the onload call is made.
28 void PreloadJavaScript(const base::string16& js_text,
29 content::RenderViewHost* preload_host);
31 // Runs |js_text| in this object's WebUI frame. Does not wait for any result.
32 void RunJavaScript(const base::string16& js_text);
34 // Runs |js_text| in this object's WebUI frame. Waits for result, logging an
35 // error message on failure. Returns test pass/fail.
36 bool RunJavaScriptTestWithResult(const base::string16& js_text);
38 // WebUIMessageHandler overrides.
39 // Add test handlers to the current WebUI object.
40 void RegisterMessages() override;
42 private:
43 // Receives testResult messages.
44 void HandleTestResult(const base::ListValue* test_result);
46 // Gets the callback that Javascript execution is complete.
47 void JavaScriptComplete(const base::Value* result);
49 // Runs a message loop until test finishes. Returns the result of the
50 // test.
51 bool WaitForResult();
53 // Received test pass/fail;
54 bool test_done_;
56 // Pass fail result of current test.
57 bool test_succeeded_;
59 // Test code finished trying to execute. This will be set to true when the
60 // selected tab is done with this execution request whether it was able to
61 // parse/execute the javascript or not.
62 bool run_test_done_;
64 // Test code was able to execute successfully. This is *NOT* the test
65 // pass/fail.
66 bool run_test_succeeded_;
68 // Waiting for a test to finish.
69 bool is_waiting_;
71 DISALLOW_COPY_AND_ASSIGN(WebUITestHandler);
74 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_