OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/extensions/extension_install_dialog.h" | 9 #include "chrome/browser/extensions/extension_install_dialog.h" |
10 #include "chrome/browser/extensions/extension_install_ui.h" | 10 #include "chrome/browser/extensions/extension_install_ui.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 73 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
74 browser()->GetSelectedTabContents()->render_view_host(), L"", | 74 browser()->GetSelectedTabContents()->render_view_host(), L"", |
75 UTF8ToWide(script), &result)); | 75 UTF8ToWide(script), &result)); |
76 EXPECT_TRUE(result); | 76 EXPECT_TRUE(result); |
77 } | 77 } |
78 | 78 |
79 std::string test_gallery_url_; | 79 std::string test_gallery_url_; |
80 }; | 80 }; |
81 | 81 |
82 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, Install) { | 82 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, Install) { |
83 SetExtensionInstallDialogForManifestAutoConfirmForTests(true); | 83 SetExtensionInstallDialogAutoConfirmForTests(true); |
84 | 84 |
85 ui_test_utils::NavigateToURL( | 85 ui_test_utils::NavigateToURL( |
86 browser(), GenerateTestServerUrl(kAppDomain, "install.html")); | 86 browser(), GenerateTestServerUrl(kAppDomain, "install.html")); |
87 | 87 |
88 RunInlineInstallTest("runTest"); | 88 RunInlineInstallTest("runTest"); |
89 | 89 |
90 const Extension* extension = browser()->profile()->GetExtensionService()-> | 90 const Extension* extension = browser()->profile()->GetExtensionService()-> |
91 GetExtensionById("ecglahbcnmdpdciemllbhojghbkagdje", false); | 91 GetExtensionById("ecglahbcnmdpdciemllbhojghbkagdje", false); |
92 EXPECT_TRUE(extension); | 92 EXPECT_TRUE(extension); |
93 } | 93 } |
94 | 94 |
95 IN_PROC_BROWSER_TEST_F( | 95 IN_PROC_BROWSER_TEST_F( |
96 WebstoreInlineInstallTest, InstallNotAllowedFromNonVerifiedDomains) { | 96 WebstoreInlineInstallTest, InstallNotAllowedFromNonVerifiedDomains) { |
97 SetExtensionInstallDialogForManifestAutoConfirmForTests(false); | 97 SetExtensionInstallDialogAutoConfirmForTests(false); |
98 ui_test_utils::NavigateToURL( | 98 ui_test_utils::NavigateToURL( |
99 browser(), | 99 browser(), |
100 GenerateTestServerUrl(kNonAppDomain, "install_non_verified_domain.html")); | 100 GenerateTestServerUrl(kNonAppDomain, "install_non_verified_domain.html")); |
101 | 101 |
102 RunInlineInstallTest("runTest1"); | 102 RunInlineInstallTest("runTest1"); |
103 RunInlineInstallTest("runTest2"); | 103 RunInlineInstallTest("runTest2"); |
104 } | 104 } |
105 | 105 |
106 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, FindLink) { | 106 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, FindLink) { |
107 ui_test_utils::NavigateToURL( | 107 ui_test_utils::NavigateToURL( |
108 browser(), GenerateTestServerUrl(kAppDomain, "find_link.html")); | 108 browser(), GenerateTestServerUrl(kAppDomain, "find_link.html")); |
109 | 109 |
110 RunInlineInstallTest("runTest"); | 110 RunInlineInstallTest("runTest"); |
111 } | 111 } |
112 | 112 |
113 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, ArgumentValidation) { | 113 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, ArgumentValidation) { |
114 SetExtensionInstallDialogForManifestAutoConfirmForTests(false); | 114 SetExtensionInstallDialogAutoConfirmForTests(false); |
115 ui_test_utils::NavigateToURL( | 115 ui_test_utils::NavigateToURL( |
116 browser(), GenerateTestServerUrl(kAppDomain, "argument_validation.html")); | 116 browser(), GenerateTestServerUrl(kAppDomain, "argument_validation.html")); |
117 | 117 |
118 RunInlineInstallTest("runTest"); | 118 RunInlineInstallTest("runTest"); |
119 } | 119 } |
120 | 120 |
121 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, InstallNotSupported) { | 121 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, InstallNotSupported) { |
122 SetExtensionInstallDialogForManifestAutoConfirmForTests(false); | 122 SetExtensionInstallDialogAutoConfirmForTests(false); |
123 ui_test_utils::NavigateToURL( | 123 ui_test_utils::NavigateToURL( |
124 browser(), | 124 browser(), |
125 GenerateTestServerUrl(kAppDomain, "install_not_supported.html")); | 125 GenerateTestServerUrl(kAppDomain, "install_not_supported.html")); |
126 | 126 |
127 RunInlineInstallTest("runTest"); | 127 RunInlineInstallTest("runTest"); |
128 | 128 |
129 // The inline install should fail, and a store-provided URL should be opened | 129 // The inline install should fail, and a store-provided URL should be opened |
130 // in a new tab. | 130 // in a new tab. |
131 if (browser()->tabstrip_model()->count() == 1) { | 131 if (browser()->tabstrip_model()->count() == 1) { |
132 ui_test_utils::WaitForNewTab(browser()); | 132 ui_test_utils::WaitForNewTab(browser()); |
(...skipping 16 matching lines...) Expand all Loading... |
149 switches::kAppsGalleryUpdateURL, crx_url.spec()); | 149 switches::kAppsGalleryUpdateURL, crx_url.spec()); |
150 } | 150 } |
151 | 151 |
152 void SetUpInProcessBrowserTestFixture() OVERRIDE { | 152 void SetUpInProcessBrowserTestFixture() OVERRIDE { |
153 WebstoreInlineInstallTest::SetUpInProcessBrowserTestFixture(); | 153 WebstoreInlineInstallTest::SetUpInProcessBrowserTestFixture(); |
154 ExtensionInstallUI::DisableFailureUIForTests(); | 154 ExtensionInstallUI::DisableFailureUIForTests(); |
155 } | 155 } |
156 }; | 156 }; |
157 | 157 |
158 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallUnpackFailureTest, Test) { | 158 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallUnpackFailureTest, Test) { |
159 SetExtensionInstallDialogForManifestAutoConfirmForTests(true); | 159 SetExtensionInstallDialogAutoConfirmForTests(true); |
160 | 160 |
161 ui_test_utils::NavigateToURL(browser(), | 161 ui_test_utils::NavigateToURL(browser(), |
162 GenerateTestServerUrl(kAppDomain, "install_unpack_failure.html")); | 162 GenerateTestServerUrl(kAppDomain, "install_unpack_failure.html")); |
163 | 163 |
164 RunInlineInstallTest("runTest"); | 164 RunInlineInstallTest("runTest"); |
165 } | 165 } |
OLD | NEW |