| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 ExtensionService* service() { | 171 ExtensionService* service() { |
| 172 return ExtensionSystem::Get(browser()->profile())->extension_service(); | 172 return ExtensionSystem::Get(browser()->profile())->extension_service(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 private: | 175 private: |
| 176 base::ScopedTempDir webstore_install_dir_; | 176 base::ScopedTempDir webstore_install_dir_; |
| 177 // WebstoreInstaller needs a reference to a FilePath when setting the download | 177 // WebstoreInstaller needs a reference to a FilePath when setting the download |
| 178 // directory for testing. | 178 // directory for testing. |
| 179 base::FilePath webstore_install_dir_copy_; | 179 base::FilePath webstore_install_dir_copy_; |
| 180 | 180 |
| 181 scoped_ptr<ScopedTestDialogAutoConfirm> auto_confirm_install_; | 181 std::unique_ptr<ScopedTestDialogAutoConfirm> auto_confirm_install_; |
| 182 | 182 |
| 183 DISALLOW_COPY_AND_ASSIGN(ExtensionWebstorePrivateApiTest); | 183 DISALLOW_COPY_AND_ASSIGN(ExtensionWebstorePrivateApiTest); |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 // Test cases for webstore origin frame blocking. | 186 // Test cases for webstore origin frame blocking. |
| 187 // TODO(mkwst): Disabled until new X-Frame-Options behavior rolls into | 187 // TODO(mkwst): Disabled until new X-Frame-Options behavior rolls into |
| 188 // Chromium, see crbug.com/226018. | 188 // Chromium, see crbug.com/226018. |
| 189 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, | 189 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, |
| 190 DISABLED_FrameWebstorePageBlocked) { | 190 DISABLED_FrameWebstorePageBlocked) { |
| 191 base::string16 expected_title = base::UTF8ToUTF16("PASS: about:blank"); | 191 base::string16 expected_title = base::UTF8ToUTF16("PASS: about:blank"); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 #define MAYBE_BeginInstall DISABLED_BeginInstall | 301 #define MAYBE_BeginInstall DISABLED_BeginInstall |
| 302 #else | 302 #else |
| 303 #define MAYBE_BeginInstall BeginInstall | 303 #define MAYBE_BeginInstall BeginInstall |
| 304 #endif | 304 #endif |
| 305 // Tests that the Approvals are properly created in beginInstall. | 305 // Tests that the Approvals are properly created in beginInstall. |
| 306 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, MAYBE_BeginInstall) { | 306 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, MAYBE_BeginInstall) { |
| 307 std::string appId = "iladmdjkfniedhfhcfoefgojhgaiaccc"; | 307 std::string appId = "iladmdjkfniedhfhcfoefgojhgaiaccc"; |
| 308 std::string extensionId = "enfkhcelefdadlmkffamgdlgplcionje"; | 308 std::string extensionId = "enfkhcelefdadlmkffamgdlgplcionje"; |
| 309 ASSERT_TRUE(RunInstallTest("begin_install.html", "extension.crx")); | 309 ASSERT_TRUE(RunInstallTest("begin_install.html", "extension.crx")); |
| 310 | 310 |
| 311 scoped_ptr<WebstoreInstaller::Approval> approval = | 311 std::unique_ptr<WebstoreInstaller::Approval> approval = |
| 312 WebstorePrivateApi::PopApprovalForTesting(browser()->profile(), appId); | 312 WebstorePrivateApi::PopApprovalForTesting(browser()->profile(), appId); |
| 313 EXPECT_EQ(appId, approval->extension_id); | 313 EXPECT_EQ(appId, approval->extension_id); |
| 314 EXPECT_TRUE(approval->use_app_installed_bubble); | 314 EXPECT_TRUE(approval->use_app_installed_bubble); |
| 315 EXPECT_FALSE(approval->skip_post_install_ui); | 315 EXPECT_FALSE(approval->skip_post_install_ui); |
| 316 EXPECT_EQ("2", approval->authuser); | 316 EXPECT_EQ("2", approval->authuser); |
| 317 EXPECT_EQ(browser()->profile(), approval->profile); | 317 EXPECT_EQ(browser()->profile(), approval->profile); |
| 318 | 318 |
| 319 approval = WebstorePrivateApi::PopApprovalForTesting( | 319 approval = WebstorePrivateApi::PopApprovalForTesting( |
| 320 browser()->profile(), extensionId); | 320 browser()->profile(), extensionId); |
| 321 EXPECT_EQ(extensionId, approval->extension_id); | 321 EXPECT_EQ(extensionId, approval->extension_id); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 351 void RunTest(bool webgl_allowed) { | 351 void RunTest(bool webgl_allowed) { |
| 352 // If Gpu access is disallowed then WebGL will not be available. | 352 // If Gpu access is disallowed then WebGL will not be available. |
| 353 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) | 353 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) |
| 354 webgl_allowed = false; | 354 webgl_allowed = false; |
| 355 | 355 |
| 356 static const char kEmptyArgs[] = "[]"; | 356 static const char kEmptyArgs[] = "[]"; |
| 357 static const char kWebGLStatusAllowed[] = "webgl_allowed"; | 357 static const char kWebGLStatusAllowed[] = "webgl_allowed"; |
| 358 static const char kWebGLStatusBlocked[] = "webgl_blocked"; | 358 static const char kWebGLStatusBlocked[] = "webgl_blocked"; |
| 359 scoped_refptr<WebstorePrivateGetWebGLStatusFunction> function = | 359 scoped_refptr<WebstorePrivateGetWebGLStatusFunction> function = |
| 360 new WebstorePrivateGetWebGLStatusFunction(); | 360 new WebstorePrivateGetWebGLStatusFunction(); |
| 361 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 361 std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
| 362 function.get(), kEmptyArgs, browser())); | 362 function.get(), kEmptyArgs, browser())); |
| 363 ASSERT_TRUE(result); | 363 ASSERT_TRUE(result); |
| 364 EXPECT_EQ(base::Value::TYPE_STRING, result->GetType()); | 364 EXPECT_EQ(base::Value::TYPE_STRING, result->GetType()); |
| 365 std::string webgl_status; | 365 std::string webgl_status; |
| 366 EXPECT_TRUE(result->GetAsString(&webgl_status)); | 366 EXPECT_TRUE(result->GetAsString(&webgl_status)); |
| 367 EXPECT_STREQ(webgl_allowed ? kWebGLStatusAllowed : kWebGLStatusBlocked, | 367 EXPECT_STREQ(webgl_allowed ? kWebGLStatusAllowed : kWebGLStatusBlocked, |
| 368 webgl_status.c_str()); | 368 webgl_status.c_str()); |
| 369 } | 369 } |
| 370 }; | 370 }; |
| 371 | 371 |
| 372 // Tests getWebGLStatus function when WebGL is allowed. | 372 // Tests getWebGLStatus function when WebGL is allowed. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 // CRX, 1 fails due to the manifests not matching, and 1 fails due to a missing | 443 // CRX, 1 fails due to the manifests not matching, and 1 fails due to a missing |
| 444 // crx file). | 444 // crx file). |
| 445 IN_PROC_BROWSER_TEST_F(BundleWebstorePrivateApiTest, InstallBundleInvalid) { | 445 IN_PROC_BROWSER_TEST_F(BundleWebstorePrivateApiTest, InstallBundleInvalid) { |
| 446 extensions::BundleInstaller::SetAutoApproveForTesting(true); | 446 extensions::BundleInstaller::SetAutoApproveForTesting(true); |
| 447 | 447 |
| 448 ASSERT_TRUE( | 448 ASSERT_TRUE( |
| 449 RunPageTest(GetTestServerURL("install_bundle_invalid.html").spec())); | 449 RunPageTest(GetTestServerURL("install_bundle_invalid.html").spec())); |
| 450 } | 450 } |
| 451 | 451 |
| 452 } // namespace extensions | 452 } // namespace extensions |
| OLD | NEW |