Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: webkit/tools/test_shell/test_shell_main_gtk.cc

Issue 10905: Unfork test_shell_main_gtk back into test_shell_main. (Closed)
Patch Set: Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "base/message_loop.h"
14 #include "webkit/glue/webkit_glue.h"
15 #include "webkit/tools/test_shell/test_shell.h"
16 #include "webkit/tools/test_shell/test_shell_switches.h"
17
18 // TODO(port): This file is intended to match test_shell_main.cc.
19 // Remerge this back into test_shell_main once we have enough supporting pieces
20 // in place.
21
22 int main(int argc, char* argv[]) {
23 // Make Singletons work.
24 base::AtExitManager at_exit_manager;
25
26 gtk_init(&argc, &argv);
27 // Only parse the command line after GTK's had a crack at it.
28 CommandLine::SetArgcArgv(argc, argv);
29
30 CommandLine parsed_command_line;
31
32 icu_util::Initialize();
33
34 bool layout_test_mode =
35 parsed_command_line.HasSwitch(test_shell::kLayoutTests);
36
37 bool interactive = !layout_test_mode;
38 TestShell::InitializeTestShell(interactive);
39
40 // Treat the first loose value as the initial URL to open.
41 std::wstring uri;
42
43 // Default to a homepage if we're interactive.
44 if (interactive) {
45 PathService::Get(base::DIR_SOURCE_ROOT, &uri);
46 file_util::AppendToPath(&uri, L"webkit");
47 file_util::AppendToPath(&uri, L"data");
48 file_util::AppendToPath(&uri, L"test_shell");
49 file_util::AppendToPath(&uri, L"index.html");
50 // For now, loading from disk doesn't work so we set the URI to the
51 // homepage.
52 uri = L"http://www.google.com";
53 }
54
55 if (parsed_command_line.GetLooseValueCount() > 0) {
56 CommandLine::LooseValueIterator iter =
57 parsed_command_line.GetLooseValuesBegin();
58 uri = *iter;
59 }
60
61 std::wstring js_flags =
62 parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags);
63 // Test shell always exposes the GC.
64 CommandLine::AppendSwitch(&js_flags, L"expose-gc");
65 webkit_glue::SetJavaScriptFlags(js_flags);
66
67 MessageLoopForUI main_message_loop;
68
69 TestShell* shell;
70 if (TestShell::CreateNewWindow(uri, &shell)) {
71 // TODO(port): the rest of this. :)
72 }
73
74 main_message_loop.Run();
75
76 return 0;
77 }
OLDNEW
« webkit/tools/test_shell/test_shell_main.cc ('K') | « webkit/tools/test_shell/test_shell_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698