| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 return crx_path; | 249 return crx_path; |
| 250 } | 250 } |
| 251 | 251 |
| 252 // This class is used to simulate an installation abort by the user. | 252 // This class is used to simulate an installation abort by the user. |
| 253 class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { | 253 class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { |
| 254 public: | 254 public: |
| 255 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL, NULL, NULL) { | 255 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL, NULL, NULL) { |
| 256 } | 256 } |
| 257 | 257 |
| 258 // Simulate a user abort on an extension installation. | 258 // Simulate a user abort on an extension installation. |
| 259 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { | 259 virtual void ConfirmInstall(Delegate* delegate, |
| 260 const Extension* extension, |
| 261 const ShowDialogCallback& show_dialog_callback) { |
| 260 delegate->InstallUIAbort(true); | 262 delegate->InstallUIAbort(true); |
| 261 MessageLoopForUI::current()->Quit(); | 263 MessageLoopForUI::current()->Quit(); |
| 262 } | 264 } |
| 263 | 265 |
| 264 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} | 266 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} |
| 265 | 267 |
| 266 virtual void OnInstallFailure(const extensions::CrxInstallerError& error) {} | 268 virtual void OnInstallFailure(const extensions::CrxInstallerError& error) {} |
| 267 }; | 269 }; |
| 268 | 270 |
| 269 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { | 271 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { |
| 270 public: | 272 public: |
| 271 explicit MockAutoConfirmExtensionInstallPrompt( | 273 explicit MockAutoConfirmExtensionInstallPrompt( |
| 272 gfx::NativeWindow parent, | 274 gfx::NativeWindow parent, |
| 273 content::PageNavigator* navigator, | 275 content::PageNavigator* navigator, |
| 274 Profile* profile) : ExtensionInstallPrompt(parent, navigator, profile) {} | 276 Profile* profile) : ExtensionInstallPrompt(parent, navigator, profile) {} |
| 275 | 277 |
| 276 // Proceed without confirmation prompt. | 278 // Proceed without confirmation prompt. |
| 277 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { | 279 virtual void ConfirmInstall(Delegate* delegate, |
| 280 const Extension* extension, |
| 281 const ShowDialogCallback& show_dialog_callback) { |
| 278 delegate->InstallUIProceed(); | 282 delegate->InstallUIProceed(); |
| 279 } | 283 } |
| 280 }; | 284 }; |
| 281 | 285 |
| 282 const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( | 286 const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( |
| 283 const FilePath& path, | 287 const FilePath& path, |
| 284 int expected_change) { | 288 int expected_change) { |
| 285 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, | 289 return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, |
| 286 expected_change, Extension::INTERNAL, | 290 expected_change, Extension::INTERNAL, |
| 287 browser(), true); | 291 browser(), true); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 case content::NOTIFICATION_LOAD_STOP: | 678 case content::NOTIFICATION_LOAD_STOP: |
| 675 VLOG(1) << "Got LOAD_STOP notification."; | 679 VLOG(1) << "Got LOAD_STOP notification."; |
| 676 MessageLoopForUI::current()->Quit(); | 680 MessageLoopForUI::current()->Quit(); |
| 677 break; | 681 break; |
| 678 | 682 |
| 679 default: | 683 default: |
| 680 NOTREACHED(); | 684 NOTREACHED(); |
| 681 break; | 685 break; |
| 682 } | 686 } |
| 683 } | 687 } |
| OLD | NEW |