Add a webstorePrivate API to show a permission prompt for delegated bundle installs
[chromium-blink-merge.git] / chrome / browser / extensions / webstore_installer_test.h
blobbe226719cb6cd2ae80edef0404b926e13ab2d2a3
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_
8 #include <string>
10 #include "base/files/scoped_temp_dir.h"
11 #include "chrome/browser/extensions/extension_browsertest.h"
12 #include "extensions/browser/extension_dialog_auto_confirm.h"
13 #include "url/gurl.h"
15 namespace base {
16 class CommandLine;
19 namespace contents {
20 class WebContents;
23 class WebstoreInstallerTest : public ExtensionBrowserTest {
24 public:
25 WebstoreInstallerTest(const std::string& webstore_domain,
26 const std::string& test_data_path,
27 const std::string& crx_filename,
28 const std::string& verified_domain,
29 const std::string& unverified_domain);
30 ~WebstoreInstallerTest() override;
32 void SetUpCommandLine(base::CommandLine* command_line) override;
33 void SetUpInProcessBrowserTestFixture() override;
34 void SetUpOnMainThread() override;
36 protected:
37 GURL GenerateTestServerUrl(const std::string& domain,
38 const std::string& page_filename);
40 void RunTest(const std::string& test_function_name);
42 void RunTest(content::WebContents* web_contents,
43 const std::string& test_function_name);
45 // Passes |i| to |test_function_name|, and expects that function to
46 // return one of "FAILED", "KEEPGOING" or "DONE". KEEPGOING should be
47 // returned if more tests remain to be run and the current test succeeded,
48 // FAILED is returned when a test fails, and DONE is returned by the last
49 // test if it succeeds.
50 // This methods returns true iff there are more tests that need to be run.
51 bool RunIndexedTest(const std::string& test_function_name, int i);
53 // Runs a test without waiting for any results from the renderer.
54 void RunTestAsync(const std::string& test_function_name);
56 // Configures command line switches to simulate a user accepting the install
57 // prompt.
58 void AutoAcceptInstall();
60 // Configures command line switches to simulate a user cancelling the install
61 // prompt.
62 void AutoCancelInstall();
64 std::string webstore_domain_;
65 std::string test_data_path_;
66 std::string crx_filename_;
67 std::string verified_domain_;
68 std::string unverified_domain_;
69 std::string test_gallery_url_;
71 base::ScopedTempDir download_directory_;
73 scoped_ptr<extensions::ScopedTestDialogAutoConfirm> install_auto_confirm_;
75 DISALLOW_COPY_AND_ASSIGN(WebstoreInstallerTest);
78 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_