OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
11 #include "chrome/browser/extensions/extension_browsertest.h" | 11 #include "chrome/browser/extensions/extension_browsertest.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class CommandLine; | 15 class CommandLine; |
16 } // namespace base | 16 } |
| 17 |
| 18 namespace contents { |
| 19 class WebContents; |
| 20 } |
17 | 21 |
18 class WebstoreInstallerTest : public ExtensionBrowserTest { | 22 class WebstoreInstallerTest : public ExtensionBrowserTest { |
19 public: | 23 public: |
20 WebstoreInstallerTest(const std::string& webstore_domain, | 24 WebstoreInstallerTest(const std::string& webstore_domain, |
21 const std::string& test_data_path, | 25 const std::string& test_data_path, |
22 const std::string& crx_filename, | 26 const std::string& crx_filename, |
23 const std::string& verified_domain, | 27 const std::string& verified_domain, |
24 const std::string& unverified_domain); | 28 const std::string& unverified_domain); |
25 ~WebstoreInstallerTest() override; | 29 ~WebstoreInstallerTest() override; |
26 | 30 |
27 void SetUpCommandLine(base::CommandLine* command_line) override; | 31 void SetUpCommandLine(base::CommandLine* command_line) override; |
28 void SetUpInProcessBrowserTestFixture() override; | 32 void SetUpInProcessBrowserTestFixture() override; |
29 void SetUpOnMainThread() override; | 33 void SetUpOnMainThread() override; |
30 | 34 |
31 protected: | 35 protected: |
32 GURL GenerateTestServerUrl(const std::string& domain, | 36 GURL GenerateTestServerUrl(const std::string& domain, |
33 const std::string& page_filename); | 37 const std::string& page_filename); |
34 | 38 |
35 void RunTest(const std::string& test_function_name); | 39 void RunTest(const std::string& test_function_name); |
36 | 40 |
| 41 void RunTest(content::WebContents* web_contents, |
| 42 const std::string& test_function_name); |
| 43 |
37 // Passes |i| to |test_function_name|, and expects that function to | 44 // Passes |i| to |test_function_name|, and expects that function to |
38 // return one of "FAILED", "KEEPGOING" or "DONE". KEEPGOING should be | 45 // return one of "FAILED", "KEEPGOING" or "DONE". KEEPGOING should be |
39 // returned if more tests remain to be run and the current test succeeded, | 46 // returned if more tests remain to be run and the current test succeeded, |
40 // FAILED is returned when a test fails, and DONE is returned by the last | 47 // FAILED is returned when a test fails, and DONE is returned by the last |
41 // test if it succeeds. | 48 // test if it succeeds. |
42 // This methods returns true iff there are more tests that need to be run. | 49 // This methods returns true iff there are more tests that need to be run. |
43 bool RunIndexedTest(const std::string& test_function_name, int i); | 50 bool RunIndexedTest(const std::string& test_function_name, int i); |
44 | 51 |
45 // Runs a test without waiting for any results from the renderer. | 52 // Runs a test without waiting for any results from the renderer. |
46 void RunTestAsync(const std::string& test_function_name); | 53 void RunTestAsync(const std::string& test_function_name); |
(...skipping 10 matching lines...) Expand all Loading... |
57 std::string test_data_path_; | 64 std::string test_data_path_; |
58 std::string crx_filename_; | 65 std::string crx_filename_; |
59 std::string verified_domain_; | 66 std::string verified_domain_; |
60 std::string unverified_domain_; | 67 std::string unverified_domain_; |
61 std::string test_gallery_url_; | 68 std::string test_gallery_url_; |
62 | 69 |
63 base::ScopedTempDir download_directory_; | 70 base::ScopedTempDir download_directory_; |
64 }; | 71 }; |
65 | 72 |
66 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_ | 73 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_ |
OLD | NEW |