| 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/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 return crx_path; | 260 return crx_path; |
| 261 } | 261 } |
| 262 | 262 |
| 263 // This class is used to simulate an installation abort by the user. | 263 // This class is used to simulate an installation abort by the user. |
| 264 class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { | 264 class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { |
| 265 public: | 265 public: |
| 266 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL) { | 266 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL) { |
| 267 } | 267 } |
| 268 | 268 |
| 269 // Simulate a user abort on an extension installation. | 269 // Simulate a user abort on an extension installation. |
| 270 virtual void ConfirmInstall(Delegate* delegate, | 270 virtual void ConfirmInstall( |
| 271 const Extension* extension, | 271 Delegate* delegate, |
| 272 const ShowDialogCallback& show_dialog_callback) { | 272 const Extension* extension, |
| 273 const ShowDialogCallback& show_dialog_callback) OVERRIDE { |
| 273 delegate->InstallUIAbort(true); | 274 delegate->InstallUIAbort(true); |
| 274 MessageLoopForUI::current()->Quit(); | 275 MessageLoopForUI::current()->Quit(); |
| 275 } | 276 } |
| 276 | 277 |
| 277 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} | 278 virtual void OnInstallSuccess(const Extension* extension, |
| 279 SkBitmap* icon) OVERRIDE {} |
| 278 | 280 |
| 279 virtual void OnInstallFailure(const extensions::CrxInstallerError& error) {} | 281 virtual void OnInstallFailure( |
| 282 const extensions::CrxInstallerError& error) OVERRIDE {} |
| 280 }; | 283 }; |
| 281 | 284 |
| 282 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { | 285 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { |
| 283 public: | 286 public: |
| 284 explicit MockAutoConfirmExtensionInstallPrompt( | 287 explicit MockAutoConfirmExtensionInstallPrompt( |
| 285 content::WebContents* web_contents) | 288 content::WebContents* web_contents) |
| 286 : ExtensionInstallPrompt(web_contents) {} | 289 : ExtensionInstallPrompt(web_contents) {} |
| 287 | 290 |
| 288 // Proceed without confirmation prompt. | 291 // Proceed without confirmation prompt. |
| 289 virtual void ConfirmInstall(Delegate* delegate, | 292 virtual void ConfirmInstall( |
| 290 const Extension* extension, | 293 Delegate* delegate, |
| 291 const ShowDialogCallback& show_dialog_callback) { | 294 const Extension* extension, |
| 295 const ShowDialogCallback& show_dialog_callback) OVERRIDE { |
| 292 delegate->InstallUIProceed(); | 296 delegate->InstallUIProceed(); |
| 293 } | 297 } |
| 294 }; | 298 }; |
| 295 | 299 |
| 296 const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( | 300 const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( |
| 297 const FilePath& path, | 301 const FilePath& path, |
| 298 int expected_change) { | 302 int expected_change) { |
| 299 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, | 303 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, |
| 300 expected_change, Manifest::INTERNAL, | 304 expected_change, Manifest::INTERNAL, |
| 301 browser(), true); | 305 browser(), true); |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 case content::NOTIFICATION_LOAD_STOP: | 694 case content::NOTIFICATION_LOAD_STOP: |
| 691 VLOG(1) << "Got LOAD_STOP notification."; | 695 VLOG(1) << "Got LOAD_STOP notification."; |
| 692 MessageLoopForUI::current()->Quit(); | 696 MessageLoopForUI::current()->Quit(); |
| 693 break; | 697 break; |
| 694 | 698 |
| 695 default: | 699 default: |
| 696 NOTREACHED(); | 700 NOTREACHED(); |
| 697 break; | 701 break; |
| 698 } | 702 } |
| 699 } | 703 } |
| OLD | NEW |