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

Side by Side Diff: content/test/layout_browsertest.h

Issue 10941011: Rewrite layout_browsertests to use content_shell --dump-render-tree to execute layout tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 3 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 #include "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/scoped_temp_dir.h" 6 #include "base/scoped_temp_dir.h"
7 #include "content/test/content_browser_test.h" 7 #include "content/test/content_browser_test.h"
8 8
9 class GURL; 9 class GURL;
10 class LayoutTestHttpServer; 10 class LayoutTestHttpServer;
11 namespace content {
12 class WebKitTestController;
13 }
11 14
12 class InProcessBrowserLayoutTest : public content::ContentBrowserTest { 15 class InProcessBrowserLayoutTest : public content::ContentBrowserTest {
13 public: 16 public:
14 explicit InProcessBrowserLayoutTest(const FilePath& test_parent_dir, 17 explicit InProcessBrowserLayoutTest(const FilePath& test_parent_dir,
15 const FilePath& test_case_dir); 18 const FilePath& test_case_dir);
16 // Used when running HTTP layout tests. Starts the server in the constructor 19 // Used when running HTTP layout tests. Starts the server in the constructor
17 // and keeps it running through the lifetime of this test. This is done to 20 // and keeps it running through the lifetime of this test. This is done to
18 // avoid flakiness in restarting the server while the port is still in use. 21 // avoid flakiness in restarting the server while the port is still in use.
19 // If -1 is passed for |port|, a random number will be used. This is 22 // If -1 is passed for |port|, a random number will be used. This is
20 // recommended when possible, in case multiple tests are running at the same 23 // recommended when possible, in case multiple tests are running at the same
21 // time. For some tests this isn't possible though, because they use resources 24 // time. For some tests this isn't possible though, because they use resources
22 // that hardcode a specific port. 25 // that hardcode a specific port.
23 InProcessBrowserLayoutTest(const FilePath& test_parent_dir, 26 InProcessBrowserLayoutTest(const FilePath& test_parent_dir,
24 const FilePath& test_case_dir, 27 const FilePath& test_case_dir,
25 int port); 28 int port);
26 virtual ~InProcessBrowserLayoutTest(); 29 virtual ~InProcessBrowserLayoutTest();
27 30
28 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; 31 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
32 virtual void SetUpOnMainThread() OVERRIDE;
33 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
29 // Runs a layout test given its filename relative to the path given to the 34 // Runs a layout test given its filename relative to the path given to the
30 // constructor. 35 // constructor.
31 void RunLayoutTest(const std::string& test_case_file_name); 36 void RunLayoutTest(const std::string& test_case_file_name);
32 // Runs a layout test using the HTTP test server. The second constructor must 37 // Runs a layout test using the HTTP test server. The second constructor must
33 // have been used. 38 // have been used.
34 void RunHttpLayoutTest(const std::string& test_case_file_name); 39 void RunHttpLayoutTest(const std::string& test_case_file_name);
35 void AddResourceForLayoutTest(const FilePath& parent_dir,
36 const FilePath& resource_name);
37 40
38 private: 41 private:
39 void RunLayoutTestInternal(const std::string& test_case_file_name, 42 void RunLayoutTestInternal(const std::string& test_case_file_name,
40 const GURL& url); 43 const GURL& url);
41 void WriteModifiedFile(const std::string& test_case_file_name,
42 FilePath* test_path);
43 std::string SaveResults(const std::string& expected, 44 std::string SaveResults(const std::string& expected,
44 const std::string& actual); 45 const std::string& actual);
45 46
46 FilePath our_original_layout_test_dir_; 47 FilePath layout_test_dir_;
47 FilePath test_parent_dir_; 48 FilePath test_parent_dir_;
48 FilePath test_case_dir_; 49 FilePath test_case_dir_;
49 FilePath our_layout_test_temp_dir_;
50 FilePath rebase_result_dir_; 50 FilePath rebase_result_dir_;
51 FilePath rebase_result_chromium_dir_; 51 FilePath rebase_result_chromium_dir_;
52 FilePath rebase_result_win_dir_; 52 FilePath rebase_result_win_dir_;
53 ScopedTempDir scoped_temp_dir_;
54 int port_; // -2 means no port. -1 means random. 53 int port_; // -2 means no port. -1 means random.
55 scoped_ptr<LayoutTestHttpServer> test_http_server_; 54 scoped_ptr<LayoutTestHttpServer> test_http_server_;
56 55
56 scoped_ptr<content::WebKitTestController> test_controller_;
57
57 DISALLOW_COPY_AND_ASSIGN(InProcessBrowserLayoutTest); 58 DISALLOW_COPY_AND_ASSIGN(InProcessBrowserLayoutTest);
58 }; 59 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698