OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 public: | 218 public: |
219 MockAbortExtensionInstallUI() : ExtensionInstallUI(NULL) {} | 219 MockAbortExtensionInstallUI() : ExtensionInstallUI(NULL) {} |
220 | 220 |
221 // Simulate a user abort on an extension installation. | 221 // Simulate a user abort on an extension installation. |
222 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { | 222 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { |
223 delegate->InstallUIAbort(true); | 223 delegate->InstallUIAbort(true); |
224 MessageLoopForUI::current()->Quit(); | 224 MessageLoopForUI::current()->Quit(); |
225 } | 225 } |
226 | 226 |
227 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} | 227 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} |
228 virtual void OnInstallFailure(const std::string& error) {} | 228 virtual void OnInstallFailure(const string16& error) {} |
229 }; | 229 }; |
230 | 230 |
231 // Mock that simulates a permissions dialog where the user allows | 231 // Mock that simulates a permissions dialog where the user allows |
232 // installation. | 232 // installation. |
233 class MockAutoConfirmExtensionInstallUI : public ExtensionInstallUI { | 233 class MockAutoConfirmExtensionInstallUI : public ExtensionInstallUI { |
234 public: | 234 public: |
235 explicit MockAutoConfirmExtensionInstallUI(Profile* profile) | 235 explicit MockAutoConfirmExtensionInstallUI(Profile* profile) |
236 : ExtensionInstallUI(profile) {} | 236 : ExtensionInstallUI(profile) {} |
237 | 237 |
238 // Proceed without confirmation prompt. | 238 // Proceed without confirmation prompt. |
239 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { | 239 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { |
240 delegate->InstallUIProceed(); | 240 delegate->InstallUIProceed(); |
241 } | 241 } |
242 | 242 |
243 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} | 243 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} |
244 virtual void OnInstallFailure(const std::string& error) {} | 244 virtual void OnInstallFailure(const string16& error) {} |
245 }; | 245 }; |
246 | 246 |
247 static DownloadManager* DownloadManagerForBrowser(Browser* browser) { | 247 static DownloadManager* DownloadManagerForBrowser(Browser* browser) { |
248 return DownloadServiceFactory::GetForProfile(browser->profile()) | 248 return DownloadServiceFactory::GetForProfile(browser->profile()) |
249 ->GetDownloadManager(); | 249 ->GetDownloadManager(); |
250 } | 250 } |
251 | 251 |
252 } // namespace | 252 } // namespace |
253 | 253 |
254 // While an object of this class exists, it will mock out download | 254 // While an object of this class exists, it will mock out download |
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 | 1729 |
1730 // Check state. | 1730 // Check state. |
1731 EXPECT_EQ(1, browser()->tab_count()); | 1731 EXPECT_EQ(1, browser()->tab_count()); |
1732 ASSERT_TRUE(CheckDownloadFullPaths(browser(), | 1732 ASSERT_TRUE(CheckDownloadFullPaths(browser(), |
1733 target_file_full_path, | 1733 target_file_full_path, |
1734 OriginFile(file))); | 1734 OriginFile(file))); |
1735 | 1735 |
1736 // Temporary downloads won't be visible. | 1736 // Temporary downloads won't be visible. |
1737 CheckDownloadUI(browser(), false, false, file); | 1737 CheckDownloadUI(browser(), false, false, file); |
1738 } | 1738 } |
OLD | NEW |