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 <ApplicationServices/ApplicationServices.h> | 5 #include <ApplicationServices/ApplicationServices.h> |
6 #import <Cocoa/Cocoa.h> | 6 #import <Cocoa/Cocoa.h> |
7 #import <objc/objc-runtime.h> | 7 #import <objc/objc-runtime.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include "webkit/tools/test_shell/test_shell.h" | 10 #include "webkit/tools/test_shell/test_shell.h" |
11 | 11 |
12 #include "app/data_pack.h" | |
13 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
14 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
15 #include "base/debug/debugger.h" | 14 #include "base/debug/debugger.h" |
16 #include "base/file_path.h" | 15 #include "base/file_path.h" |
17 #include "base/file_util.h" | 16 #include "base/file_util.h" |
18 #include "base/logging.h" | 17 #include "base/logging.h" |
19 #include "base/mac/mac_util.h" | 18 #include "base/mac/mac_util.h" |
20 #include "base/memory_debug.h" | 19 #include "base/memory_debug.h" |
21 #include "base/message_loop.h" | 20 #include "base/message_loop.h" |
22 #include "base/path_service.h" | 21 #include "base/path_service.h" |
23 #include "base/string16.h" | 22 #include "base/string16.h" |
24 #include "base/string_piece.h" | 23 #include "base/string_piece.h" |
25 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
26 #include "gfx/size.h" | 25 #include "gfx/size.h" |
27 #include "grit/webkit_resources.h" | 26 #include "grit/webkit_resources.h" |
28 #include "net/base/mime_util.h" | 27 #include "net/base/mime_util.h" |
29 #include "skia/ext/bitmap_platform_device.h" | 28 #include "skia/ext/bitmap_platform_device.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 32 #include "ui/base/resource/data_pack.h" |
33 #include "webkit/glue/webkit_glue.h" | 33 #include "webkit/glue/webkit_glue.h" |
34 #include "webkit/glue/webpreferences.h" | 34 #include "webkit/glue/webpreferences.h" |
35 #include "webkit/plugins/npapi/plugin_list.h" | 35 #include "webkit/plugins/npapi/plugin_list.h" |
36 #include "webkit/tools/test_shell/mac/test_shell_webview.h" | 36 #include "webkit/tools/test_shell/mac/test_shell_webview.h" |
37 #include "webkit/tools/test_shell/resource.h" | 37 #include "webkit/tools/test_shell/resource.h" |
38 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 38 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
39 #include "webkit/tools/test_shell/test_navigation_controller.h" | 39 #include "webkit/tools/test_shell/test_navigation_controller.h" |
40 #include "webkit/tools/test_shell/test_webview_delegate.h" | 40 #include "webkit/tools/test_shell/test_webview_delegate.h" |
41 | 41 |
42 #include "third_party/skia/include/core/SkBitmap.h" | 42 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 19 matching lines...) Expand all Loading... |
62 // The W3C SVG layout tests use a different size than the other layout tests | 62 // The W3C SVG layout tests use a different size than the other layout tests |
63 const int kSVGTestWindowWidth = 480; | 63 const int kSVGTestWindowWidth = 480; |
64 const int kSVGTestWindowHeight = 360; | 64 const int kSVGTestWindowHeight = 360; |
65 | 65 |
66 // Hide the window offscreen when in layout test mode. Mac OS X limits | 66 // Hide the window offscreen when in layout test mode. Mac OS X limits |
67 // window positions to +/- 16000. | 67 // window positions to +/- 16000. |
68 const int kTestWindowXLocation = -14000; | 68 const int kTestWindowXLocation = -14000; |
69 const int kTestWindowYLocation = -14000; | 69 const int kTestWindowYLocation = -14000; |
70 | 70 |
71 // Data pack resource. This is a pointer to the mmapped resources file. | 71 // Data pack resource. This is a pointer to the mmapped resources file. |
72 static app::DataPack* g_resource_data_pack = NULL; | 72 static ui::DataPack* g_resource_data_pack = NULL; |
73 | 73 |
74 // Define static member variables | 74 // Define static member variables |
75 base::LazyInstance <std::map<gfx::NativeWindow, TestShell *> > | 75 base::LazyInstance <std::map<gfx::NativeWindow, TestShell *> > |
76 TestShell::window_map_(base::LINKER_INITIALIZED); | 76 TestShell::window_map_(base::LINKER_INITIALIZED); |
77 | 77 |
78 // Helper method for getting the path to the test shell resources directory. | 78 // Helper method for getting the path to the test shell resources directory. |
79 FilePath GetResourcesFilePath() { | 79 FilePath GetResourcesFilePath() { |
80 FilePath path; | 80 FilePath path; |
81 // We need to know if we're bundled or not to know which path to use. | 81 // We need to know if we're bundled or not to know which path to use. |
82 if (base::mac::AmIBundled()) { | 82 if (base::mac::AmIBundled()) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 window_list_ = new WindowList; | 203 window_list_ = new WindowList; |
204 layout_test_mode_ = layout_test_mode; | 204 layout_test_mode_ = layout_test_mode; |
205 allow_external_pages_ = allow_external_pages; | 205 allow_external_pages_ = allow_external_pages; |
206 | 206 |
207 web_prefs_ = new WebPreferences; | 207 web_prefs_ = new WebPreferences; |
208 | 208 |
209 // mmap the data pack which holds strings used by WebCore. This is only | 209 // mmap the data pack which holds strings used by WebCore. This is only |
210 // a fatal error if we're bundled, which means we might be running layout | 210 // a fatal error if we're bundled, which means we might be running layout |
211 // tests. This is a harmless failure for test_shell_tests. | 211 // tests. This is a harmless failure for test_shell_tests. |
212 g_resource_data_pack = new app::DataPack; | 212 g_resource_data_pack = new ui::DataPack; |
213 NSString *resource_path = | 213 NSString *resource_path = |
214 [base::mac::MainAppBundle() pathForResource:@"test_shell" | 214 [base::mac::MainAppBundle() pathForResource:@"test_shell" |
215 ofType:@"pak"]; | 215 ofType:@"pak"]; |
216 FilePath resources_pak_path([resource_path fileSystemRepresentation]); | 216 FilePath resources_pak_path([resource_path fileSystemRepresentation]); |
217 if (!g_resource_data_pack->Load(resources_pak_path)) { | 217 if (!g_resource_data_pack->Load(resources_pak_path)) { |
218 LOG(FATAL) << "failed to load test_shell.pak"; | 218 LOG(FATAL) << "failed to load test_shell.pak"; |
219 } | 219 } |
220 | 220 |
221 ResetWebPreferences(); | 221 ResetWebPreferences(); |
222 | 222 |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 return false; | 734 return false; |
735 } | 735 } |
736 | 736 |
737 void DidLoadPlugin(const std::string& filename) { | 737 void DidLoadPlugin(const std::string& filename) { |
738 } | 738 } |
739 | 739 |
740 void DidUnloadPlugin(const std::string& filename) { | 740 void DidUnloadPlugin(const std::string& filename) { |
741 } | 741 } |
742 | 742 |
743 } // namespace webkit_glue | 743 } // namespace webkit_glue |
OLD | NEW |