| 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 "chrome/browser/extensions/extension_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 return crx_path; | 341 return crx_path; |
| 342 } | 342 } |
| 343 | 343 |
| 344 // This class is used to simulate an installation abort by the user. | 344 // This class is used to simulate an installation abort by the user. |
| 345 class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { | 345 class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { |
| 346 public: | 346 public: |
| 347 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL) { | 347 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL) { |
| 348 } | 348 } |
| 349 | 349 |
| 350 // Simulate a user abort on an extension installation. | 350 // Simulate a user abort on an extension installation. |
| 351 virtual void ConfirmInstall( | 351 void ConfirmInstall(Delegate* delegate, |
| 352 Delegate* delegate, | 352 const Extension* extension, |
| 353 const Extension* extension, | 353 const ShowDialogCallback& show_dialog_callback) override { |
| 354 const ShowDialogCallback& show_dialog_callback) override { | |
| 355 delegate->InstallUIAbort(true); | 354 delegate->InstallUIAbort(true); |
| 356 base::MessageLoopForUI::current()->Quit(); | 355 base::MessageLoopForUI::current()->Quit(); |
| 357 } | 356 } |
| 358 | 357 |
| 359 virtual void OnInstallSuccess(const Extension* extension, | 358 void OnInstallSuccess(const Extension* extension, SkBitmap* icon) override {} |
| 360 SkBitmap* icon) override {} | |
| 361 | 359 |
| 362 virtual void OnInstallFailure( | 360 void OnInstallFailure(const extensions::CrxInstallerError& error) override {} |
| 363 const extensions::CrxInstallerError& error) override {} | |
| 364 }; | 361 }; |
| 365 | 362 |
| 366 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { | 363 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { |
| 367 public: | 364 public: |
| 368 explicit MockAutoConfirmExtensionInstallPrompt( | 365 explicit MockAutoConfirmExtensionInstallPrompt( |
| 369 content::WebContents* web_contents) | 366 content::WebContents* web_contents) |
| 370 : ExtensionInstallPrompt(web_contents) {} | 367 : ExtensionInstallPrompt(web_contents) {} |
| 371 | 368 |
| 372 // Proceed without confirmation prompt. | 369 // Proceed without confirmation prompt. |
| 373 virtual void ConfirmInstall( | 370 void ConfirmInstall(Delegate* delegate, |
| 374 Delegate* delegate, | 371 const Extension* extension, |
| 375 const Extension* extension, | 372 const ShowDialogCallback& show_dialog_callback) override { |
| 376 const ShowDialogCallback& show_dialog_callback) override { | |
| 377 delegate->InstallUIProceed(); | 373 delegate->InstallUIProceed(); |
| 378 } | 374 } |
| 379 }; | 375 }; |
| 380 | 376 |
| 381 const Extension* ExtensionBrowserTest::UpdateExtensionWaitForIdle( | 377 const Extension* ExtensionBrowserTest::UpdateExtensionWaitForIdle( |
| 382 const std::string& id, | 378 const std::string& id, |
| 383 const base::FilePath& path, | 379 const base::FilePath& path, |
| 384 int expected_change) { | 380 int expected_change) { |
| 385 return InstallOrUpdateExtension(id, | 381 return InstallOrUpdateExtension(id, |
| 386 path, | 382 path, |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 return extensions::browsertest_util::ExecuteScriptInBackgroundPage( | 653 return extensions::browsertest_util::ExecuteScriptInBackgroundPage( |
| 658 profile(), extension_id, script); | 654 profile(), extension_id, script); |
| 659 } | 655 } |
| 660 | 656 |
| 661 bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait( | 657 bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait( |
| 662 const std::string& extension_id, | 658 const std::string& extension_id, |
| 663 const std::string& script) { | 659 const std::string& script) { |
| 664 return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait( | 660 return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait( |
| 665 profile(), extension_id, script); | 661 profile(), extension_id, script); |
| 666 } | 662 } |
| OLD | NEW |