| 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 "app/data_pack.h" |
| 15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
| 19 #include "base/string16.h" | 19 #include "base/string16.h" |
| 20 #include "base/string_piece.h" | 20 #include "base/string_piece.h" |
| 21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 22 #include "grit/test_shell_resources.h" | 22 #include "grit/test_shell_resources.h" |
| 23 #include "grit/webkit_resources.h" | 23 #include "grit/webkit_resources.h" |
| 24 #include "net/base/mime_util.h" | 24 #include "net/base/mime_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 // Convert a FilePath into an FcChar* (used by fontconfig). | 41 // Convert a FilePath into an FcChar* (used by fontconfig). |
| 42 // The pointer only lives for the duration for the expression. | 42 // The pointer only lives for the duration for the expression. |
| 43 const FcChar8* FilePathAsFcChar(const FilePath& path) { | 43 const FcChar8* FilePathAsFcChar(const FilePath& path) { |
| 44 return reinterpret_cast<const FcChar8*>(path.value().c_str()); | 44 return reinterpret_cast<const FcChar8*>(path.value().c_str()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Data resources on linux. This is a pointer to the mmapped resources file. | 47 // Data resources on linux. This is a pointer to the mmapped resources file. |
| 48 base::DataPack* g_resource_data_pack = NULL; | 48 app::DataPack* g_resource_data_pack = NULL; |
| 49 | 49 |
| 50 void TerminationSignalHandler(int signatl) { | 50 void TerminationSignalHandler(int signatl) { |
| 51 TestShell::ShutdownTestShell(); | 51 TestShell::ShutdownTestShell(); |
| 52 exit(0); | 52 exit(0); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // GTK callbacks ------------------------------------------------------ | 55 // GTK callbacks ------------------------------------------------------ |
| 56 | 56 |
| 57 // Callback for when the main window is destroyed. | 57 // Callback for when the main window is destroyed. |
| 58 gboolean MainWindowDestroyed(GtkWindow* window, TestShell* shell) { | 58 gboolean MainWindowDestroyed(GtkWindow* window, TestShell* shell) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 // static | 153 // static |
| 154 void TestShell::InitializeTestShell(bool layout_test_mode, | 154 void TestShell::InitializeTestShell(bool layout_test_mode, |
| 155 bool allow_external_pages) { | 155 bool allow_external_pages) { |
| 156 window_list_ = new WindowList; | 156 window_list_ = new WindowList; |
| 157 layout_test_mode_ = layout_test_mode; | 157 layout_test_mode_ = layout_test_mode; |
| 158 allow_external_pages_ = allow_external_pages; | 158 allow_external_pages_ = allow_external_pages; |
| 159 | 159 |
| 160 web_prefs_ = new WebPreferences; | 160 web_prefs_ = new WebPreferences; |
| 161 | 161 |
| 162 g_resource_data_pack = new base::DataPack; | 162 g_resource_data_pack = new app::DataPack; |
| 163 FilePath data_path; | 163 FilePath data_path; |
| 164 PathService::Get(base::DIR_EXE, &data_path); | 164 PathService::Get(base::DIR_EXE, &data_path); |
| 165 data_path = data_path.Append("test_shell.pak"); | 165 data_path = data_path.Append("test_shell.pak"); |
| 166 if (!g_resource_data_pack->Load(data_path)) { | 166 if (!g_resource_data_pack->Load(data_path)) { |
| 167 LOG(FATAL) << "failed to load test_shell.pak"; | 167 LOG(FATAL) << "failed to load test_shell.pak"; |
| 168 } | 168 } |
| 169 | 169 |
| 170 FilePath resources_dir; | 170 FilePath resources_dir; |
| 171 PathService::Get(base::DIR_SOURCE_ROOT, &resources_dir); | 171 PathService::Get(base::DIR_SOURCE_ROOT, &resources_dir); |
| 172 resources_dir = resources_dir.Append("webkit/tools/test_shell/resources"); | 172 resources_dir = resources_dir.Append("webkit/tools/test_shell/resources"); |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 resource_id = IDR_BROKENIMAGE_TESTSHELL; | 652 resource_id = IDR_BROKENIMAGE_TESTSHELL; |
| 653 break; | 653 break; |
| 654 case IDR_TEXTAREA_RESIZER: | 654 case IDR_TEXTAREA_RESIZER: |
| 655 resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; | 655 resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL; |
| 656 break; | 656 break; |
| 657 } | 657 } |
| 658 return TestShell::NetResourceProvider(resource_id); | 658 return TestShell::NetResourceProvider(resource_id); |
| 659 } | 659 } |
| 660 | 660 |
| 661 } // namespace webkit_glue | 661 } // namespace webkit_glue |
| OLD | NEW |