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