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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_
10 #include "base/files/scoped_temp_dir.h"
11 #include "chrome/browser/extensions/extension_browsertest.h"
22 class WebstoreInstallerTest
: public ExtensionBrowserTest
{
24 WebstoreInstallerTest(const std::string
& webstore_domain
,
25 const std::string
& test_data_path
,
26 const std::string
& crx_filename
,
27 const std::string
& verified_domain
,
28 const std::string
& unverified_domain
);
29 ~WebstoreInstallerTest() override
;
31 void SetUpCommandLine(base::CommandLine
* command_line
) override
;
32 void SetUpInProcessBrowserTestFixture() override
;
33 void SetUpOnMainThread() override
;
36 GURL
GenerateTestServerUrl(const std::string
& domain
,
37 const std::string
& page_filename
);
39 void RunTest(const std::string
& test_function_name
);
41 void RunTest(content::WebContents
* web_contents
,
42 const std::string
& test_function_name
);
44 // Passes |i| to |test_function_name|, and expects that function to
45 // return one of "FAILED", "KEEPGOING" or "DONE". KEEPGOING should be
46 // returned if more tests remain to be run and the current test succeeded,
47 // FAILED is returned when a test fails, and DONE is returned by the last
48 // test if it succeeds.
49 // This methods returns true iff there are more tests that need to be run.
50 bool RunIndexedTest(const std::string
& test_function_name
, int i
);
52 // Runs a test without waiting for any results from the renderer.
53 void RunTestAsync(const std::string
& test_function_name
);
55 // Configures command line switches to simulate a user accepting the install
57 void AutoAcceptInstall();
59 // Configures command line switches to simulate a user cancelling the install
61 void AutoCancelInstall();
63 std::string webstore_domain_
;
64 std::string test_data_path_
;
65 std::string crx_filename_
;
66 std::string verified_domain_
;
67 std::string unverified_domain_
;
68 std::string test_gallery_url_
;
70 base::ScopedTempDir download_directory_
;
73 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_