Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2704)

Side by Side Diff: content/shell/webkit_test_controller.h

Issue 11819028: [content shell] report the PID of a crashed renderer, and always report crashes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/shell/webkit_test_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CONTROLLER_H_ 5 #ifndef CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_
6 #define CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ 6 #define CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_
7 7
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 10
11 #include "base/cancelable_callback.h" 11 #include "base/cancelable_callback.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h"
15 #include "content/public/browser/render_view_host_observer.h" 17 #include "content/public/browser/render_view_host_observer.h"
16 #include "content/public/browser/web_contents_observer.h" 18 #include "content/public/browser/web_contents_observer.h"
17 #include "webkit/glue/webpreferences.h" 19 #include "webkit/glue/webpreferences.h"
18 20
19 class SkBitmap; 21 class SkBitmap;
20 22
21 namespace content { 23 namespace content {
22 24
23 class Shell; 25 class Shell;
24 26
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 State state_; 60 State state_;
59 bool capture_text_only_; 61 bool capture_text_only_;
60 62
61 std::ostream* output_; 63 std::ostream* output_;
62 std::ostream* error_; 64 std::ostream* error_;
63 65
64 DISALLOW_COPY_AND_ASSIGN(WebKitTestResultPrinter); 66 DISALLOW_COPY_AND_ASSIGN(WebKitTestResultPrinter);
65 }; 67 };
66 68
67 class WebKitTestController : public base::NonThreadSafe, 69 class WebKitTestController : public base::NonThreadSafe,
68 public WebContentsObserver { 70 public WebContentsObserver,
71 public NotificationObserver {
69 public: 72 public:
70 static WebKitTestController* Get(); 73 static WebKitTestController* Get();
71 74
72 WebKitTestController(); 75 WebKitTestController();
73 virtual ~WebKitTestController(); 76 virtual ~WebKitTestController();
74 77
75 // True if the controller is ready for testing. 78 // True if the controller is ready for testing.
76 bool PrepareForLayoutTest(const GURL& test_url, 79 bool PrepareForLayoutTest(const GURL& test_url,
77 const FilePath& current_working_directory, 80 const FilePath& current_working_directory,
78 bool enable_pixel_dumping, 81 bool enable_pixel_dumping,
(...skipping 15 matching lines...) Expand all
94 // This method can be invoked on any thread. 97 // This method can be invoked on any thread.
95 bool CanOpenWindows() const; 98 bool CanOpenWindows() const;
96 99
97 // WebContentsObserver implementation. 100 // WebContentsObserver implementation.
98 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 101 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
99 virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE; 102 virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE;
100 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; 103 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
101 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; 104 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
102 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; 105 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
103 106
107 // NotificationObserver implementation.
108 virtual void Observe(int type,
109 const NotificationSource& source,
110 const NotificationDetails& details) OVERRIDE;
111
104 private: 112 private:
105 static WebKitTestController* instance_; 113 static WebKitTestController* instance_;
106 114
107 void CaptureDump(); 115 void CaptureDump();
108 void TimeoutHandler(); 116 void TimeoutHandler();
109 117
110 // Message handlers. 118 // Message handlers.
111 void OnDidFinishLoad(); 119 void OnDidFinishLoad();
112 void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image); 120 void OnImageDump(const std::string& actual_pixel_hash, const SkBitmap& image);
113 void OnTextDump(const std::string& dump); 121 void OnTextDump(const std::string& dump);
(...skipping 15 matching lines...) Expand all
129 137
130 void OnNotImplemented(const std::string& object_name, 138 void OnNotImplemented(const std::string& object_name,
131 const std::string& method_name); 139 const std::string& method_name);
132 140
133 scoped_ptr<WebKitTestResultPrinter> printer_; 141 scoped_ptr<WebKitTestResultPrinter> printer_;
134 142
135 FilePath current_working_directory_; 143 FilePath current_working_directory_;
136 144
137 Shell* main_window_; 145 Shell* main_window_;
138 146
147 int current_pid_;
148
139 bool enable_pixel_dumping_; 149 bool enable_pixel_dumping_;
140 std::string expected_pixel_hash_; 150 std::string expected_pixel_hash_;
141 151
142 bool captured_dump_; 152 bool captured_dump_;
143 153
144 bool dump_as_text_; 154 bool dump_as_text_;
145 bool dump_child_frames_; 155 bool dump_child_frames_;
146 bool is_printing_; 156 bool is_printing_;
147 bool should_stay_on_page_after_handling_before_unload_; 157 bool should_stay_on_page_after_handling_before_unload_;
148 bool wait_until_done_; 158 bool wait_until_done_;
149 bool did_finish_load_; 159 bool did_finish_load_;
150 160
151 webkit_glue::WebPreferences prefs_; 161 webkit_glue::WebPreferences prefs_;
152 bool should_override_prefs_; 162 bool should_override_prefs_;
153 163
154 base::CancelableClosure watchdog_; 164 base::CancelableClosure watchdog_;
155 165
156 // Access to the following variables needs to be guarded by |lock_|. 166 // Access to the following variables needs to be guarded by |lock_|.
157 mutable base::Lock lock_; 167 mutable base::Lock lock_;
158 bool can_open_windows_; 168 bool can_open_windows_;
159 169
170 NotificationRegistrar registrar_;
171
160 DISALLOW_COPY_AND_ASSIGN(WebKitTestController); 172 DISALLOW_COPY_AND_ASSIGN(WebKitTestController);
161 }; 173 };
162 174
163 } // namespace content 175 } // namespace content
164 176
165 #endif // CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_ 177 #endif // CONTENT_SHELL_WEBKIT_TEST_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | content/shell/webkit_test_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698