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

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

Issue 10656044: Add basic support to dump pixel results (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 5 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
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_LAYOUT_TEST_CONTROLLER_HOST_H_ 5 #ifndef CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_HOST_H_
6 #define CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_HOST_H_ 6 #define CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "content/public/browser/render_view_host_observer.h" 12 #include "content/public/browser/render_view_host_observer.h"
13 13
14 class SkBitmap;
15
14 namespace content { 16 namespace content {
15 17
16 class LayoutTestControllerHost : public RenderViewHostObserver { 18 class LayoutTestControllerHost : public RenderViewHostObserver {
17 public: 19 public:
18 static LayoutTestControllerHost* FromRenderViewHost( 20 static LayoutTestControllerHost* FromRenderViewHost(
19 RenderViewHost* render_view_host); 21 RenderViewHost* render_view_host);
20 22
23 // Initialize the LayoutTestControllerHost for a given test.
24 static void Init(const std::string& expected_pixel_hash);
25
21 explicit LayoutTestControllerHost(RenderViewHost* render_view_host); 26 explicit LayoutTestControllerHost(RenderViewHost* render_view_host);
22 virtual ~LayoutTestControllerHost(); 27 virtual ~LayoutTestControllerHost();
23 28
24 bool should_stay_on_page_after_handling_before_unload() const { 29 bool should_stay_on_page_after_handling_before_unload() const {
25 return should_stay_on_page_after_handling_before_unload_; 30 return should_stay_on_page_after_handling_before_unload_;
26 } 31 }
27 32
28 // RenderViewHostObserver implementation. 33 // RenderViewHostObserver implementation.
29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 34 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
30 35
31 private: 36 private:
32 void CaptureDump(); 37 void CaptureDump();
33 38
34 // Message handlers. 39 // Message handlers.
35 void OnDidFinishLoad(); 40 void OnDidFinishLoad();
36 void OnTextDump(const std::string& dump); 41 void OnTextDump(const std::string& dump);
42 void OnImageDump(const SkBitmap& image);
37 43
38 // layoutTestController handlers. 44 // layoutTestController handlers.
39 void OnNotifyDone(); 45 void OnNotifyDone();
40 void OnDumpAsText(); 46 void OnDumpAsText();
41 void OnDumpChildFramesAsText(); 47 void OnDumpChildFramesAsText();
42 void OnSetPrinting(); 48 void OnSetPrinting();
43 void OnSetShouldStayOnPageAfterHandlingBeforeUnload(bool should_stay_on_page); 49 void OnSetShouldStayOnPageAfterHandlingBeforeUnload(bool should_stay_on_page);
44 void OnWaitUntilDone(); 50 void OnWaitUntilDone();
45 51
46 static std::map<RenderViewHost*, LayoutTestControllerHost*> controllers_; 52 static std::map<RenderViewHost*, LayoutTestControllerHost*> controllers_;
53 static std::string expected_pixel_hash_;
47 54
48 bool dump_as_text_; 55 bool dump_as_text_;
49 bool dump_child_frames_; 56 bool dump_child_frames_;
50 bool is_printing_; 57 bool is_printing_;
51 bool should_stay_on_page_after_handling_before_unload_; 58 bool should_stay_on_page_after_handling_before_unload_;
52 bool wait_until_done_; 59 bool wait_until_done_;
53 60
54 DISALLOW_COPY_AND_ASSIGN(LayoutTestControllerHost); 61 DISALLOW_COPY_AND_ASSIGN(LayoutTestControllerHost);
55 }; 62 };
56 63
57 } // namespace content 64 } // namespace content
58 65
59 #endif // CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_HOST_H_ 66 #endif // CONTENT_SHELL_LAYOUT_TEST_CONTROLLER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698