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

Side by Side Diff: chrome/browser/extensions/webstore_installer_test.h

Issue 2655823002: Include referrer chain with inline install requests. (Closed)
Patch Set: cleanup Created 3 years, 10 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
OLDNEW
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;
34 void SetUpInProcessBrowserTestFixture() override; 40 void SetUpInProcessBrowserTestFixture() override;
35 void SetUpOnMainThread() override; 41 void SetUpOnMainThread() override;
36 42
43 void MonitorServerRequest(const net::test_server::HttpRequest& request);
44
37 protected: 45 protected:
38 GURL GenerateTestServerUrl(const std::string& domain, 46 GURL GenerateTestServerUrl(const std::string& domain,
39 const std::string& page_filename); 47 const std::string& page_filename);
40 48
41 void RunTest(const std::string& test_function_name); 49 void RunTest(const std::string& test_function_name);
42 50
43 void RunTest(content::WebContents* web_contents, 51 void RunTest(content::WebContents* web_contents,
44 const std::string& test_function_name); 52 const std::string& test_function_name);
45 53
46 // Passes |i| to |test_function_name|, and expects that function to 54 // Passes |i| to |test_function_name|, and expects that function to
47 // return one of "FAILED", "KEEPGOING" or "DONE". KEEPGOING should be 55 // return one of "FAILED", "KEEPGOING" or "DONE". KEEPGOING should be
48 // returned if more tests remain to be run and the current test succeeded, 56 // 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 57 // FAILED is returned when a test fails, and DONE is returned by the last
50 // test if it succeeds. 58 // test if it succeeds.
51 // This methods returns true iff there are more tests that need to be run. 59 // 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); 60 bool RunIndexedTest(const std::string& test_function_name, int i);
53 61
54 // Runs a test without waiting for any results from the renderer. 62 // Runs a test without waiting for any results from the renderer.
55 void RunTestAsync(const std::string& test_function_name); 63 void RunTestAsync(const std::string& test_function_name);
56 64
65 // Can be overridden to inspect requests to the embedded test server.
66 virtual void ProcessServerRequest(
67 const net::test_server::HttpRequest& request);
68
57 // Configures command line switches to simulate a user accepting the install 69 // Configures command line switches to simulate a user accepting the install
58 // prompt. 70 // prompt.
59 void AutoAcceptInstall(); 71 void AutoAcceptInstall();
60 72
61 // Configures command line switches to simulate a user cancelling the install 73 // Configures command line switches to simulate a user cancelling the install
62 // prompt. 74 // prompt.
63 void AutoCancelInstall(); 75 void AutoCancelInstall();
64 76
65 std::string webstore_domain_; 77 std::string webstore_domain_;
66 std::string test_data_path_; 78 std::string test_data_path_;
67 std::string crx_filename_; 79 std::string crx_filename_;
68 std::string verified_domain_; 80 std::string verified_domain_;
69 std::string unverified_domain_; 81 std::string unverified_domain_;
70 std::string test_gallery_url_; 82 std::string test_gallery_url_;
71 83
72 base::ScopedTempDir download_directory_; 84 base::ScopedTempDir download_directory_;
73 85
74 std::unique_ptr<extensions::ScopedTestDialogAutoConfirm> 86 std::unique_ptr<extensions::ScopedTestDialogAutoConfirm>
75 install_auto_confirm_; 87 install_auto_confirm_;
76 88
77 DISALLOW_COPY_AND_ASSIGN(WebstoreInstallerTest); 89 DISALLOW_COPY_AND_ASSIGN(WebstoreInstallerTest);
78 }; 90 };
79 91
80 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_ 92 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698