OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_ | 26 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_ |
27 #define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_ | 27 #define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_ |
28 | 28 |
29 #pragma once | 29 #pragma once |
30 | 30 |
31 #include <string> | 31 #include <string> |
32 #include <list> | 32 #include <list> |
33 | 33 |
34 #include "base/basictypes.h" | 34 #include "base/basictypes.h" |
| 35 #include "base/file_path.h" |
35 #if defined(OS_MACOSX) | 36 #if defined(OS_MACOSX) |
36 #include "base/lazy_instance.h" | 37 #include "base/lazy_instance.h" |
37 #endif | 38 #endif |
38 #include "base/ref_counted.h" | 39 #include "base/ref_counted.h" |
39 #include "base/weak_ptr.h" | 40 #include "base/weak_ptr.h" |
40 #include "gfx/native_widget_types.h" | 41 #include "gfx/native_widget_types.h" |
41 #include "third_party/WebKit/WebKit/chromium/public/WebNavigationPolicy.h" | 42 #include "third_party/WebKit/WebKit/chromium/public/WebNavigationPolicy.h" |
42 #include "webkit/tools/test_shell/event_sending_controller.h" | 43 #include "webkit/tools/test_shell/event_sending_controller.h" |
43 #include "webkit/tools/test_shell/layout_test_controller.h" | 44 #include "webkit/tools/test_shell/layout_test_controller.h" |
44 #include "webkit/tools/test_shell/plain_text_controller.h" | 45 #include "webkit/tools/test_shell/plain_text_controller.h" |
45 #include "webkit/tools/test_shell/text_input_controller.h" | 46 #include "webkit/tools/test_shell/text_input_controller.h" |
46 #include "webkit/tools/test_shell/webview_host.h" | 47 #include "webkit/tools/test_shell/webview_host.h" |
47 #include "webkit/tools/test_shell/webwidget_host.h" | 48 #include "webkit/tools/test_shell/webwidget_host.h" |
48 | 49 |
49 typedef std::list<gfx::NativeWindow> WindowList; | 50 typedef std::list<gfx::NativeWindow> WindowList; |
50 | 51 |
51 struct WebPreferences; | 52 struct WebPreferences; |
52 class AccessibilityController; | 53 class AccessibilityController; |
53 class FilePath; | |
54 class GURL; | 54 class GURL; |
55 class TestNavigationEntry; | 55 class TestNavigationEntry; |
56 class TestNavigationController; | 56 class TestNavigationController; |
57 class TestNotificationPresenter; | 57 class TestNotificationPresenter; |
58 class TestShellDevToolsAgent; | 58 class TestShellDevToolsAgent; |
59 class TestShellDevToolsClient; | 59 class TestShellDevToolsClient; |
60 class TestWebViewDelegate; | 60 class TestWebViewDelegate; |
61 | 61 |
62 namespace base { | 62 namespace base { |
63 class StringPiece; | 63 class StringPiece; |
64 } | 64 } |
65 | 65 |
66 class TestShell : public base::SupportsWeakPtr<TestShell> { | 66 class TestShell : public base::SupportsWeakPtr<TestShell> { |
67 public: | 67 public: |
68 struct TestParams { | 68 struct TestParams { |
69 // Load the test defaults. | 69 // Load the test defaults. |
70 TestParams() : dump_tree(true), dump_pixels(false) { | 70 TestParams() : dump_tree(true), dump_pixels(false) { |
71 } | 71 } |
72 | 72 |
73 // The kind of output we want from this test. | 73 // The kind of output we want from this test. |
74 bool dump_tree; | 74 bool dump_tree; |
75 bool dump_pixels; | 75 bool dump_pixels; |
76 | 76 |
77 // Filename we dump pixels to (when pixel testing is enabled). | 77 // Filename we dump pixels to (when pixel testing is enabled). |
78 std::wstring pixel_file_name; | 78 FilePath pixel_file_name; |
79 // The md5 hash of the bitmap dump (when pixel testing is enabled). | 79 // The md5 hash of the bitmap dump (when pixel testing is enabled). |
80 std::string pixel_hash; | 80 std::string pixel_hash; |
81 // URL of the test. | 81 // URL of the test. |
82 std::string test_url; | 82 std::string test_url; |
83 }; | 83 }; |
84 | 84 |
85 TestShell(); | 85 TestShell(); |
86 virtual ~TestShell(); | 86 virtual ~TestShell(); |
87 | 87 |
88 // Initialization and clean up of logging. | 88 // Initialization and clean up of logging. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 return layout_test_controller_->AcceptsEditing(); | 195 return layout_test_controller_->AcceptsEditing(); |
196 } | 196 } |
197 | 197 |
198 void LoadFile(const FilePath& file); | 198 void LoadFile(const FilePath& file); |
199 void LoadURL(const GURL& url); | 199 void LoadURL(const GURL& url); |
200 void LoadURLForFrame(const GURL& url, const std::wstring& frame_name); | 200 void LoadURLForFrame(const GURL& url, const std::wstring& frame_name); |
201 void GoBackOrForward(int offset); | 201 void GoBackOrForward(int offset); |
202 void Reload(); | 202 void Reload(); |
203 bool Navigate(const TestNavigationEntry& entry, bool reload); | 203 bool Navigate(const TestNavigationEntry& entry, bool reload); |
204 | 204 |
205 bool PromptForSaveFile(const wchar_t* prompt_title, std::wstring* result); | 205 bool PromptForSaveFile(const wchar_t* prompt_title, FilePath* result); |
206 std::wstring GetDocumentText(); | 206 std::wstring GetDocumentText(); |
207 void DumpDocumentText(); | 207 void DumpDocumentText(); |
208 void DumpRenderTree(); | 208 void DumpRenderTree(); |
209 | 209 |
210 gfx::NativeWindow mainWnd() const { return m_mainWnd; } | 210 gfx::NativeWindow mainWnd() const { return m_mainWnd; } |
211 gfx::NativeView webViewWnd() const { return m_webViewHost->view_handle(); } | 211 gfx::NativeView webViewWnd() const { return m_webViewHost->view_handle(); } |
212 gfx::NativeEditView editWnd() const { return m_editWnd; } | 212 gfx::NativeEditView editWnd() const { return m_editWnd; } |
213 gfx::NativeView popupWnd() const { return m_popupHost->view_handle(); } | 213 gfx::NativeView popupWnd() const { return m_popupHost->view_handle(); } |
214 | 214 |
215 static WindowList* windowList() { return window_list_; } | 215 static WindowList* windowList() { return window_list_; } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // Writes the back-forward list data for this test shell into result. | 255 // Writes the back-forward list data for this test shell into result. |
256 void DumpBackForwardList(std::wstring* result); | 256 void DumpBackForwardList(std::wstring* result); |
257 | 257 |
258 // Dumps the output from given test as text and/or image depending on | 258 // Dumps the output from given test as text and/or image depending on |
259 // the flags set. | 259 // the flags set. |
260 static void Dump(TestShell* shell); | 260 static void Dump(TestShell* shell); |
261 | 261 |
262 // Writes the image captured from the given web frame to the given file. | 262 // Writes the image captured from the given web frame to the given file. |
263 // The returned string is the ASCII-ized MD5 sum of the image. | 263 // The returned string is the ASCII-ized MD5 sum of the image. |
264 static std::string DumpImage(skia::PlatformCanvas* canvas, | 264 static std::string DumpImage(skia::PlatformCanvas* canvas, |
265 const std::wstring& file_name, | 265 const FilePath& path, |
266 const std::string& pixel_hash); | 266 const std::string& pixel_hash); |
267 | 267 |
268 static void ResetWebPreferences(); | 268 static void ResetWebPreferences(); |
269 | 269 |
270 static void SetAllowScriptsToCloseWindows(); | 270 static void SetAllowScriptsToCloseWindows(); |
271 | 271 |
272 WebPreferences* GetWebPreferences() { return web_prefs_; } | 272 WebPreferences* GetWebPreferences() { return web_prefs_; } |
273 | 273 |
274 // Some layout tests hardcode a file:///tmp/LayoutTests URL. We get around | 274 // Some layout tests hardcode a file:///tmp/LayoutTests URL. We get around |
275 // this by substituting "tmp" with the path to the LayoutTests parent dir. | 275 // this by substituting "tmp" with the path to the LayoutTests parent dir. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 #if defined(OS_WIN) | 436 #if defined(OS_WIN) |
437 // Used by the watchdog to know when it's finished. | 437 // Used by the watchdog to know when it's finished. |
438 HANDLE finished_event_; | 438 HANDLE finished_event_; |
439 #endif | 439 #endif |
440 | 440 |
441 // Dump the stats table counters on exit. | 441 // Dump the stats table counters on exit. |
442 bool dump_stats_table_on_exit_; | 442 bool dump_stats_table_on_exit_; |
443 }; | 443 }; |
444 | 444 |
445 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_ | 445 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_ |
OLD | NEW |