| 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 "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/extensions/extension_browsertest.h" | 12 #include "chrome/browser/extensions/extension_browsertest.h" |
| 13 #include "extensions/browser/extension_dialog_auto_confirm.h" | 13 #include "extensions/browser/extension_dialog_auto_confirm.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class CommandLine; | 17 class CommandLine; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace contents { | 20 namespace contents { |
| 21 class WebContents; | 21 class WebContents; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace net { |
| 25 namespace test_server { |
| 26 struct HttpRequest; |
| 27 } |
| 28 } |
| 29 |
| 24 class WebstoreInstallerTest : public ExtensionBrowserTest { | 30 class WebstoreInstallerTest : public ExtensionBrowserTest { |
| 25 public: | 31 public: |
| 26 WebstoreInstallerTest(const std::string& webstore_domain, | 32 WebstoreInstallerTest(const std::string& webstore_domain, |
| 27 const std::string& test_data_path, | 33 const std::string& test_data_path, |
| 28 const std::string& crx_filename, | 34 const std::string& crx_filename, |
| 29 const std::string& verified_domain, | 35 const std::string& verified_domain, |
| 30 const std::string& unverified_domain); | 36 const std::string& unverified_domain); |
| 31 ~WebstoreInstallerTest() override; | 37 ~WebstoreInstallerTest() override; |
| 32 | 38 |
| 33 void SetUpCommandLine(base::CommandLine* command_line) override; | 39 void SetUpCommandLine(base::CommandLine* command_line) override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 // return one of "FAILED", "KEEPGOING" or "DONE". KEEPGOING should be | 53 // return one of "FAILED", "KEEPGOING" or "DONE". KEEPGOING should be |
| 48 // returned if more tests remain to be run and the current test succeeded, | 54 // returned if more tests remain to be run and the current test succeeded, |
| 49 // FAILED is returned when a test fails, and DONE is returned by the last | 55 // FAILED is returned when a test fails, and DONE is returned by the last |
| 50 // test if it succeeds. | 56 // test if it succeeds. |
| 51 // This methods returns true iff there are more tests that need to be run. | 57 // This methods returns true iff there are more tests that need to be run. |
| 52 bool RunIndexedTest(const std::string& test_function_name, int i); | 58 bool RunIndexedTest(const std::string& test_function_name, int i); |
| 53 | 59 |
| 54 // Runs a test without waiting for any results from the renderer. | 60 // Runs a test without waiting for any results from the renderer. |
| 55 void RunTestAsync(const std::string& test_function_name); | 61 void RunTestAsync(const std::string& test_function_name); |
| 56 | 62 |
| 63 // Can be overridden to inspect requests to the embedded test server. |
| 64 virtual void ProcessServerRequest( |
| 65 const net::test_server::HttpRequest& request); |
| 66 |
| 57 // Configures command line switches to simulate a user accepting the install | 67 // Configures command line switches to simulate a user accepting the install |
| 58 // prompt. | 68 // prompt. |
| 59 void AutoAcceptInstall(); | 69 void AutoAcceptInstall(); |
| 60 | 70 |
| 61 // Configures command line switches to simulate a user cancelling the install | 71 // Configures command line switches to simulate a user cancelling the install |
| 62 // prompt. | 72 // prompt. |
| 63 void AutoCancelInstall(); | 73 void AutoCancelInstall(); |
| 64 | 74 |
| 65 std::string webstore_domain_; | 75 std::string webstore_domain_; |
| 66 std::string test_data_path_; | 76 std::string test_data_path_; |
| 67 std::string crx_filename_; | 77 std::string crx_filename_; |
| 68 std::string verified_domain_; | 78 std::string verified_domain_; |
| 69 std::string unverified_domain_; | 79 std::string unverified_domain_; |
| 70 std::string test_gallery_url_; | 80 std::string test_gallery_url_; |
| 71 | 81 |
| 72 base::ScopedTempDir download_directory_; | 82 base::ScopedTempDir download_directory_; |
| 73 | 83 |
| 74 std::unique_ptr<extensions::ScopedTestDialogAutoConfirm> | 84 std::unique_ptr<extensions::ScopedTestDialogAutoConfirm> |
| 75 install_auto_confirm_; | 85 install_auto_confirm_; |
| 76 | 86 |
| 77 DISALLOW_COPY_AND_ASSIGN(WebstoreInstallerTest); | 87 DISALLOW_COPY_AND_ASSIGN(WebstoreInstallerTest); |
| 78 }; | 88 }; |
| 79 | 89 |
| 80 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_ | 90 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_ |
| OLD | NEW |