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 #ifndef CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_ | 5 #ifndef CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_ |
6 #define CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_ | 6 #define CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_ |
7 | 7 |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 void PrintTextHeader(); | 35 void PrintTextHeader(); |
36 void PrintTextBlock(const std::string& block); | 36 void PrintTextBlock(const std::string& block); |
37 void PrintTextFooter(); | 37 void PrintTextFooter(); |
38 | 38 |
39 void PrintImageHeader(const std::string& actual_hash, | 39 void PrintImageHeader(const std::string& actual_hash, |
40 const std::string& expected_hash); | 40 const std::string& expected_hash); |
41 void PrintImageBlock(const std::vector<unsigned char>& png_image); | 41 void PrintImageBlock(const std::vector<unsigned char>& png_image); |
42 void PrintImageFooter(); | 42 void PrintImageFooter(); |
43 | 43 |
44 void AddMessage(const std::string& message); | 44 void AddMessage(const std::string& message); |
| 45 void AddMessageRaw(const std::string& message); |
45 void AddErrorMessage(const std::string& message); | 46 void AddErrorMessage(const std::string& message); |
46 | 47 |
47 private: | 48 private: |
48 enum State { | 49 enum State { |
49 BEFORE_TEST, | 50 BEFORE_TEST, |
50 IN_TEXT_BLOCK, | 51 IN_TEXT_BLOCK, |
51 IN_IMAGE_BLOCK, | 52 IN_IMAGE_BLOCK, |
52 AFTER_TEST | 53 AFTER_TEST |
53 }; | 54 }; |
54 State state_; | 55 State state_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 bool dump_child_frames() const { return dump_child_frames_; } | 102 bool dump_child_frames() const { return dump_child_frames_; } |
102 void set_dump_child_frames(bool dump_child_frames) { | 103 void set_dump_child_frames(bool dump_child_frames) { |
103 dump_child_frames_ = dump_child_frames; | 104 dump_child_frames_ = dump_child_frames; |
104 } | 105 } |
105 bool is_printing() const { return is_printing_; } | 106 bool is_printing() const { return is_printing_; } |
106 void set_is_printing(bool is_printing) { is_printing_ = is_printing; } | 107 void set_is_printing(bool is_printing) { is_printing_ = is_printing; } |
107 | 108 |
108 // WebContentsObserver implementation. | 109 // WebContentsObserver implementation. |
109 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 110 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
110 virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE; | 111 virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE; |
| 112 virtual void RenderViewReady() OVERRIDE; |
111 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 113 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
112 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; | 114 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; |
113 | 115 |
114 private: | 116 private: |
115 static WebKitTestController* instance_; | 117 static WebKitTestController* instance_; |
116 | 118 |
117 void CaptureDump(); | 119 void CaptureDump(); |
118 void TimeoutHandler(); | 120 void TimeoutHandler(); |
119 | 121 |
120 // Message handlers. | 122 // Message handlers. |
121 void OnDidFinishLoad(); | 123 void OnDidFinishLoad(); |
122 void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); | 124 void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); |
123 void OnTextDump(const std::string& dump); | 125 void OnTextDump(const std::string& dump); |
| 126 void OnPrintMessage(const std::string& message); |
124 | 127 |
125 scoped_ptr<WebKitTestResultPrinter> printer_; | 128 scoped_ptr<WebKitTestResultPrinter> printer_; |
126 | 129 |
127 Shell* main_window_; | 130 Shell* main_window_; |
128 | 131 |
129 bool enable_pixel_dumping_; | 132 bool enable_pixel_dumping_; |
130 std::string expected_pixel_hash_; | 133 std::string expected_pixel_hash_; |
131 | 134 |
132 bool captured_dump_; | 135 bool captured_dump_; |
133 | 136 |
134 bool dump_as_text_; | 137 bool dump_as_text_; |
135 bool dump_child_frames_; | 138 bool dump_child_frames_; |
136 bool is_printing_; | 139 bool is_printing_; |
137 bool should_stay_on_page_after_handling_before_unload_; | 140 bool should_stay_on_page_after_handling_before_unload_; |
138 bool wait_until_done_; | 141 bool wait_until_done_; |
139 | 142 |
| 143 bool did_set_as_main_window_; |
| 144 |
140 base::CancelableClosure watchdog_; | 145 base::CancelableClosure watchdog_; |
141 | 146 |
142 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); | 147 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); |
143 }; | 148 }; |
144 | 149 |
145 class WebKitTestRunnerHost : public RenderViewHostObserver { | 150 class WebKitTestRunnerHost : public RenderViewHostObserver { |
146 public: | 151 public: |
147 explicit WebKitTestRunnerHost(RenderViewHost* render_view_host); | 152 explicit WebKitTestRunnerHost(RenderViewHost* render_view_host); |
148 virtual ~WebKitTestRunnerHost(); | 153 virtual ~WebKitTestRunnerHost(); |
149 | 154 |
(...skipping 11 matching lines...) Expand all Loading... |
161 | 166 |
162 void OnNotImplemented(const std::string& object_name, | 167 void OnNotImplemented(const std::string& object_name, |
163 const std::string& method_name); | 168 const std::string& method_name); |
164 | 169 |
165 DISALLOW_COPY_AND_ASSIGN(WebKitTestRunnerHost); | 170 DISALLOW_COPY_AND_ASSIGN(WebKitTestRunnerHost); |
166 }; | 171 }; |
167 | 172 |
168 } // namespace content | 173 } // namespace content |
169 | 174 |
170 #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_ | 175 #endif // CONTENT_SHELL_WEBKIT_TEST_RUNNER_HOST_H_ |
OLD | NEW |