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