OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <cstdlib> | 5 #include <cstdlib> |
6 #include <map> | 6 #include <map> |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 #include <utility> | 10 #include <utility> |
(...skipping 18 matching lines...) Expand all Loading... |
29 using std::make_pair; | 29 using std::make_pair; |
30 using std::map; | 30 using std::map; |
31 using std::set; | 31 using std::set; |
32 using std::string; | 32 using std::string; |
33 using std::vector; | 33 using std::vector; |
34 | 34 |
35 // TODO: If this gets significantly more complicated, it really needs to | 35 // TODO: If this gets significantly more complicated, it really needs to |
36 // be OO-ified. | 36 // be OO-ified. |
37 | 37 |
38 const static char* kUsage = | 38 const static char* kUsage = |
39 "Usage: xtest SCRIPT-FILE\n" | 39 "Usage: autox SCRIPT-FILE\n" |
40 "\n" | 40 "\n" |
41 "SCRIPT-FILE is a JSON file (with trailing commas allowed) consisting\n" | 41 "SCRIPT-FILE is a JSON file (with trailing commas allowed) consisting\n" |
42 "of a list of input events that should be injected into the X server\n" | 42 "of a list of input events that should be injected into the X server\n" |
43 "using the XTEST extension. Each event is described by a list containing\n" | 43 "using the XTEST extension. Each event is described by a list containing\n" |
44 "the following:\n" | 44 "the following:\n" |
45 "\n" | 45 "\n" |
46 " COMMAND, ARG1, ARG2, ...\n" | 46 " COMMAND, ARG1, ARG2, ...\n" |
47 "\n" | 47 "\n" |
48 "The following commands are available:\n" | 48 "The following commands are available:\n" |
49 "\n" | 49 "\n" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 FilePath script_path = FilePath(argv[1]); | 459 FilePath script_path = FilePath(argv[1]); |
460 string script; | 460 string script; |
461 CHECK(file_util::ReadFileToString(script_path, &script)) | 461 CHECK(file_util::ReadFileToString(script_path, &script)) |
462 << "Unable to read script file \"" << script_path.value() << "\""; | 462 << "Unable to read script file \"" << script_path.value() << "\""; |
463 Display* display = XOpenDisplay(NULL); | 463 Display* display = XOpenDisplay(NULL); |
464 CHECK(display) << "Couldn't open connection to X server"; | 464 CHECK(display) << "Couldn't open connection to X server"; |
465 RunScript(script, display); | 465 RunScript(script, display); |
466 XCloseDisplay(display); | 466 XCloseDisplay(display); |
467 return 0; | 467 return 0; |
468 } | 468 } |
OLD | NEW |