| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 bool ExtensionBrowserTest::LoadExtensionIncognito(const FilePath& path) { | 80 bool ExtensionBrowserTest::LoadExtensionIncognito(const FilePath& path) { |
| 81 return LoadExtensionImpl(path, true); | 81 return LoadExtensionImpl(path, true); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // This class is used to simulate an installation abort by the user. | 84 // This class is used to simulate an installation abort by the user. |
| 85 class MockAbortExtensionInstallUI : public ExtensionInstallUI { | 85 class MockAbortExtensionInstallUI : public ExtensionInstallUI { |
| 86 public: | 86 public: |
| 87 MockAbortExtensionInstallUI() : ExtensionInstallUI(NULL) {} | 87 MockAbortExtensionInstallUI() : ExtensionInstallUI(NULL) {} |
| 88 | 88 |
| 89 // Simulate a user abort on an extension installation. | 89 // Simulate a user abort on an extension installation. |
| 90 void ConfirmInstall( | 90 virtual void ConfirmInstall(Delegate* delegate, Extension* extension) { |
| 91 Delegate* delegate, Extension* extension, SkBitmap* icon) { | |
| 92 delegate->InstallUIAbort(); | 91 delegate->InstallUIAbort(); |
| 93 MessageLoopForUI::current()->Quit(); | 92 MessageLoopForUI::current()->Quit(); |
| 94 } | 93 } |
| 95 | 94 |
| 96 void ConfirmUninstall(Delegate* delegate, Extension* extension, | 95 virtual void ConfirmUninstall(Delegate* delegate, Extension* extension) {} |
| 97 SkBitmap* icon) {} | |
| 98 | 96 |
| 99 void OnInstallSuccess(Extension* extension) {} | 97 virtual void OnInstallSuccess(Extension* extension) {} |
| 100 | 98 |
| 101 void OnInstallFailure(const std::string& error) {} | 99 virtual void OnInstallFailure(const std::string& error) {} |
| 102 | 100 |
| 103 void OnOverinstallAttempted(Extension* extension) {} | 101 virtual void OnOverinstallAttempted(Extension* extension) {} |
| 104 }; | 102 }; |
| 105 | 103 |
| 106 bool ExtensionBrowserTest::InstallOrUpdateExtension(const std::string& id, | 104 bool ExtensionBrowserTest::InstallOrUpdateExtension(const std::string& id, |
| 107 const FilePath& path, | 105 const FilePath& path, |
| 108 bool should_cancel, | 106 bool should_cancel, |
| 109 int expected_change) { | 107 int expected_change) { |
| 110 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 108 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
| 111 service->set_show_extensions_prompts(false); | 109 service->set_show_extensions_prompts(false); |
| 112 size_t num_before = service->extensions()->size(); | 110 size_t num_before = service->extensions()->size(); |
| 113 | 111 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 MessageLoopForUI::current()->Quit(); | 338 MessageLoopForUI::current()->Quit(); |
| 341 } | 339 } |
| 342 break; | 340 break; |
| 343 } | 341 } |
| 344 | 342 |
| 345 default: | 343 default: |
| 346 NOTREACHED(); | 344 NOTREACHED(); |
| 347 break; | 345 break; |
| 348 } | 346 } |
| 349 } | 347 } |
| OLD | NEW |