OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 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 #include <gtk/gtk.h> |
| 6 |
| 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" |
| 10 #include "base/icu_util.h" |
| 11 #include "base/path_service.h" |
| 12 #include "base/string_util.h" |
| 13 #include "webkit/tools/test_shell/test_shell.h" |
| 14 #include "webkit/tools/test_shell/test_shell_switches.h" |
| 15 |
| 16 // TODO(port): This file is intended to match test_shell_main.cc. |
| 17 // Remerge this back into test_shell_main once we have enough supporting pieces |
| 18 // in place. |
| 19 |
| 20 int main(int argc, char* argv[]) { |
| 21 // Make Singletons work. |
| 22 base::AtExitManager at_exit_manager; |
| 23 |
| 24 gtk_init(&argc, &argv); |
| 25 // Only parse the command line after GTK's had a crack at it. |
| 26 CommandLine::SetArgcArgv(argc, argv); |
| 27 |
| 28 CommandLine parsed_command_line; |
| 29 |
| 30 icu_util::Initialize(); |
| 31 |
| 32 bool layout_test_mode = |
| 33 parsed_command_line.HasSwitch(test_shell::kLayoutTests); |
| 34 |
| 35 bool interactive = !layout_test_mode; |
| 36 TestShell::InitializeTestShell(interactive); |
| 37 |
| 38 // Treat the first loose value as the initial URL to open. |
| 39 std::wstring uri; |
| 40 |
| 41 // Default to a homepage if we're interactive. |
| 42 if (interactive) { |
| 43 PathService::Get(base::DIR_SOURCE_ROOT, &uri); |
| 44 file_util::AppendToPath(&uri, L"webkit"); |
| 45 file_util::AppendToPath(&uri, L"data"); |
| 46 file_util::AppendToPath(&uri, L"test_shell"); |
| 47 file_util::AppendToPath(&uri, L"index.html"); |
| 48 } |
| 49 |
| 50 if (parsed_command_line.GetLooseValueCount() > 0) { |
| 51 CommandLine::LooseValueIterator iter = |
| 52 parsed_command_line.GetLooseValuesBegin(); |
| 53 uri = *iter; |
| 54 } |
| 55 |
| 56 TestShell* shell; |
| 57 if (TestShell::CreateNewWindow(uri, &shell)) { |
| 58 // TODO(port): the rest of this. :) |
| 59 } |
| 60 |
| 61 // TODO(port): use MessageLoop instead. |
| 62 gtk_main(); |
| 63 |
| 64 return 0; |
| 65 } |
OLD | NEW |