| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/string16.h" | 18 #include "base/string16.h" |
| 19 #include "base/string_piece.h" | 19 #include "base/string_piece.h" |
| 20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 21 #include "grit/test_shell_resources.h" | 21 #include "grit/test_shell_resources.h" |
| 22 #include "grit/webkit_resources.h" | 22 #include "grit/webkit_resources.h" |
| 23 #include "net/base/mime_util.h" | 23 #include "net/base/mime_util.h" |
| 24 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | |
| 28 #include "ui/base/gtk/gtk_compat.h" | 28 #include "ui/base/gtk/gtk_compat.h" |
| 29 #include "ui/base/layout.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "webkit/glue/resource_loader_bridge.h" | 31 #include "webkit/glue/resource_loader_bridge.h" |
| 31 #include "webkit/glue/webkit_glue.h" | 32 #include "webkit/glue/webkit_glue.h" |
| 32 #include "webkit/glue/webpreferences.h" | 33 #include "webkit/glue/webpreferences.h" |
| 33 #include "webkit/plugins/npapi/plugin_list.h" | 34 #include "webkit/plugins/npapi/plugin_list.h" |
| 34 #include "webkit/tools/test_shell/test_navigation_controller.h" | 35 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 35 #include "webkit/tools/test_shell/test_shell_webkit_init.h" | 36 #include "webkit/tools/test_shell/test_shell_webkit_init.h" |
| 36 #include "webkit/tools/test_shell/test_webview_delegate.h" | 37 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 37 | 38 |
| 38 using WebKit::WebPoint; | 39 using WebKit::WebPoint; |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 void TestShell::ShowStartupDebuggingDialog() { | 553 void TestShell::ShowStartupDebuggingDialog() { |
| 553 GtkWidget* dialog = gtk_message_dialog_new( | 554 GtkWidget* dialog = gtk_message_dialog_new( |
| 554 NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "attach to me?"); | 555 NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "attach to me?"); |
| 555 gtk_window_set_title(GTK_WINDOW(dialog), "test_shell"); | 556 gtk_window_set_title(GTK_WINDOW(dialog), "test_shell"); |
| 556 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. | 557 gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. |
| 557 gtk_widget_destroy(dialog); | 558 gtk_widget_destroy(dialog); |
| 558 } | 559 } |
| 559 | 560 |
| 560 // static | 561 // static |
| 561 base::StringPiece TestShell::ResourceProvider(int key) { | 562 base::StringPiece TestShell::ResourceProvider(int key) { |
| 562 return ResourceBundle::GetSharedInstance().GetRawDataResource(key); | 563 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 564 key, ui::kScaleFactorNone); |
| 563 } | 565 } |
| 564 | 566 |
| 565 //----------------------------------------------------------------------------- | 567 //----------------------------------------------------------------------------- |
| 566 | 568 |
| 567 string16 TestShellWebKitInit::GetLocalizedString(int message_id) { | 569 string16 TestShellWebKitInit::GetLocalizedString(int message_id) { |
| 568 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); | 570 return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); |
| 569 } | 571 } |
| 570 | 572 |
| 571 base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) { | 573 base::StringPiece TestShellWebKitInit::GetDataResource( |
| 572 return TestShell::ResourceProvider(resource_id); | 574 int resource_id, |
| 573 } | 575 ui::ScaleFactor scale_factor) { |
| 574 | |
| 575 base::StringPiece TestShellWebKitInit::GetImageResource(int resource_id, | |
| 576 float scale_factor) { | |
| 577 switch (resource_id) { | 576 switch (resource_id) { |
| 578 case IDR_BROKENIMAGE: | 577 case IDR_BROKENIMAGE: |
| 579 resource_id = IDR_BROKENIMAGE_TESTSHELL; | 578 resource_id = IDR_BROKENIMAGE_TESTSHELL; |
| 580 break; | 579 break; |
| 581 case IDR_TEXTAREA_RESIZER: | 580 case IDR_TEXTAREA_RESIZER: |
| 582 resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; | 581 resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; |
| 583 break; | 582 break; |
| 584 } | 583 } |
| 585 // TODO(flackr): Pass scale_factor. | 584 // TODO(flackr): Pass scale_factor. |
| 586 return TestShell::ResourceProvider(resource_id); | 585 return TestShell::ResourceProvider(resource_id); |
| 587 } | 586 } |
| OLD | NEW |