Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 10683003: Moved CrxInstaller and CrxInstallerError into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest-er master Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL, NULL, NULL) { 162 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL, NULL, NULL) {
163 } 163 }
164 164
165 // Simulate a user abort on an extension installation. 165 // Simulate a user abort on an extension installation.
166 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { 166 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) {
167 delegate->InstallUIAbort(true); 167 delegate->InstallUIAbort(true);
168 MessageLoopForUI::current()->Quit(); 168 MessageLoopForUI::current()->Quit();
169 } 169 }
170 170
171 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} 171 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {}
172 virtual void OnInstallFailure(const CrxInstallerError& error) {} 172 virtual void OnInstallFailure(const extensions::CrxInstallerError& error) {}
173 }; 173 };
174 174
175 // Mock that simulates a permissions dialog where the user allows 175 // Mock that simulates a permissions dialog where the user allows
176 // installation. 176 // installation.
177 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { 177 class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt {
178 public: 178 public:
179 explicit MockAutoConfirmExtensionInstallPrompt( 179 explicit MockAutoConfirmExtensionInstallPrompt(
180 gfx::NativeWindow parent, 180 gfx::NativeWindow parent,
181 content::PageNavigator* navigator, 181 content::PageNavigator* navigator,
182 Profile* profile) 182 Profile* profile)
183 : ExtensionInstallPrompt(parent, navigator, profile) {} 183 : ExtensionInstallPrompt(parent, navigator, profile) {}
184 184
185 // Proceed without confirmation prompt. 185 // Proceed without confirmation prompt.
186 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { 186 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) {
187 delegate->InstallUIProceed(); 187 delegate->InstallUIProceed();
188 } 188 }
189 189
190 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} 190 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {}
191 virtual void OnInstallFailure(const CrxInstallerError& error) {} 191 virtual void OnInstallFailure(const extensions::CrxInstallerError& error) {}
192 }; 192 };
193 193
194 static DownloadManager* DownloadManagerForBrowser(Browser* browser) { 194 static DownloadManager* DownloadManagerForBrowser(Browser* browser) {
195 return BrowserContext::GetDownloadManager(browser->profile()); 195 return BrowserContext::GetDownloadManager(browser->profile());
196 } 196 }
197 197
198 class TestRenderViewContextMenu : public RenderViewContextMenu { 198 class TestRenderViewContextMenu : public RenderViewContextMenu {
199 public: 199 public:
200 TestRenderViewContextMenu(WebContents* web_contents, 200 TestRenderViewContextMenu(WebContents* web_contents,
201 const content::ContextMenuParams& params) 201 const content::ContextMenuParams& params)
(...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after
2497 GetDownloads(browser(), &download_items); 2497 GetDownloads(browser(), &download_items);
2498 ASSERT_EQ(1u, download_items.size()); 2498 ASSERT_EQ(1u, download_items.size());
2499 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), 2499 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"),
2500 download_items[0]->GetOriginalUrl()); 2500 download_items[0]->GetOriginalUrl());
2501 2501
2502 // Check that the file contains the expected referrer. 2502 // Check that the file contains the expected referrer.
2503 FilePath file(download_items[0]->GetFullPath()); 2503 FilePath file(download_items[0]->GetFullPath());
2504 std::string expected_contents = test_server()->GetURL("").spec(); 2504 std::string expected_contents = test_server()->GetURL("").spec();
2505 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); 2505 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length()));
2506 } 2506 }
OLDNEW
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | chrome/browser/download/download_crx_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698