OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 "webkit/tools/test_shell/test_shell.h" | 5 #include "webkit/tools/test_shell/test_shell.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <fontconfig/fontconfig.h> | 9 #include <fontconfig/fontconfig.h> |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
11 #include <signal.h> | 11 #include <signal.h> |
12 #include <unistd.h> | 12 #include <unistd.h> |
13 | 13 |
| 14 #include "base/data_pack.h" |
14 #include "base/file_path.h" | 15 #include "base/file_path.h" |
15 #include "base/file_util.h" | 16 #include "base/file_util.h" |
16 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
17 #include "base/path_service.h" | 18 #include "base/path_service.h" |
| 19 #include "base/string_piece.h" |
18 #include "base/string_util.h" | 20 #include "base/string_util.h" |
19 #include "net/base/mime_util.h" | 21 #include "net/base/mime_util.h" |
20 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
21 #include "webkit/glue/plugins/plugin_list.h" | 23 #include "webkit/glue/plugins/plugin_list.h" |
22 #include "webkit/glue/resource_loader_bridge.h" | 24 #include "webkit/glue/resource_loader_bridge.h" |
23 #include "webkit/glue/webdatasource.h" | 25 #include "webkit/glue/webdatasource.h" |
24 #include "webkit/glue/webframe.h" | 26 #include "webkit/glue/webframe.h" |
25 #include "webkit/glue/webkit_glue.h" | 27 #include "webkit/glue/webkit_glue.h" |
26 #include "webkit/glue/webpreferences.h" | 28 #include "webkit/glue/webpreferences.h" |
27 #include "webkit/glue/webview.h" | 29 #include "webkit/glue/webview.h" |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 611 |
610 // static | 612 // static |
611 void TestShell::ShowStartupDebuggingDialog() { | 613 void TestShell::ShowStartupDebuggingDialog() { |
612 GtkWidget* dialog = gtk_message_dialog_new( | 614 GtkWidget* dialog = gtk_message_dialog_new( |
613 NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "attach to me?"); | 615 NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "attach to me?"); |
614 gtk_window_set_title(GTK_WINDOW(dialog), "test_shell"); | 616 gtk_window_set_title(GTK_WINDOW(dialog), "test_shell"); |
615 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. | 617 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. |
616 gtk_widget_destroy(dialog); | 618 gtk_widget_destroy(dialog); |
617 } | 619 } |
618 | 620 |
| 621 // static |
| 622 StringPiece TestShell::NetResourceProvider(int key) { |
| 623 static scoped_ptr<base::DataPack> resource_data_pack; |
| 624 |
| 625 if (!resource_data_pack.get()) { |
| 626 resource_data_pack.reset(new base::DataPack); |
| 627 FilePath data_path; |
| 628 PathService::Get(base::DIR_EXE, &data_path); |
| 629 data_path = data_path.Append("test_shell.pak"); |
| 630 bool success = resource_data_pack->Load(data_path); |
| 631 CHECK(success) << "failed to load test_shell.pak"; |
| 632 } |
| 633 |
| 634 StringPiece res; |
| 635 resource_data_pack->Get(key, &res); |
| 636 return res; |
| 637 } |
| 638 |
619 //----------------------------------------------------------------------------- | 639 //----------------------------------------------------------------------------- |
620 | 640 |
621 namespace webkit_glue { | 641 namespace webkit_glue { |
622 | 642 |
623 // TODO(deanm): This is just a shim for now. We need to extend GRIT to do | 643 // TODO(deanm): This is just a shim for now. We need to extend GRIT to do |
624 // proper resources on Linux, and figure out exactly how we'll do localization. | 644 // proper resources on Linux, and figure out exactly how we'll do localization. |
625 // For now this is just a copy of webkit_strings_en-US.rc in switch form. | 645 // For now this is just a copy of webkit_strings_en-US.rc in switch form. |
626 std::wstring GetLocalizedString(int message_id) { | 646 std::wstring GetLocalizedString(int message_id) { |
627 const char* str = NULL; | 647 const char* str = NULL; |
628 | 648 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 } | 776 } |
757 | 777 |
758 bool GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { | 778 bool GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { |
759 // TODO(port): Implement plugins someday. Don't let the error message | 779 // TODO(port): Implement plugins someday. Don't let the error message |
760 // of NOTIMPLEMENTED into our layout test diffs. | 780 // of NOTIMPLEMENTED into our layout test diffs. |
761 // NOTIMPLEMENTED(); | 781 // NOTIMPLEMENTED(); |
762 return false; | 782 return false; |
763 } | 783 } |
764 | 784 |
765 } // namespace webkit_glue | 785 } // namespace webkit_glue |
OLD | NEW |