summaryrefslogtreecommitdiffstats
path: root/extensions/browser/updater
diff options
context:
space:
mode:
authortreib <treib@chromium.org>2015-10-14 06:14:32 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-14 13:15:17 +0000
commit0e1ad00d48dba2110fea1def45da38c41bbe9707 (patch)
tree2364480e510622b5e1a93213800b374d5b7f9511 /extensions/browser/updater
parente2e8203894a66a04ba79c3e0f0b249cf1ee7dbbe (diff)
downloadchromium_src-0e1ad00d48dba2110fea1def45da38c41bbe9707.zip
chromium_src-0e1ad00d48dba2110fea1def45da38c41bbe9707.tar.gz
chromium_src-0e1ad00d48dba2110fea1def45da38c41bbe9707.tar.bz2
Add tests for FileDownloader
BUG=none Review URL: https://codereview.chromium.org/1355293002 Cr-Commit-Position: refs/heads/master@{#354009}
Diffstat (limited to 'extensions/browser/updater')
-rw-r--r--extensions/browser/updater/update_service_browsertest.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/extensions/browser/updater/update_service_browsertest.cc b/extensions/browser/updater/update_service_browsertest.cc
index bd9a55e..097de35 100644
--- a/extensions/browser/updater/update_service_browsertest.cc
+++ b/extensions/browser/updater/update_service_browsertest.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/bind.h"
+#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "content/public/test/test_browser_thread_bundle.h"
@@ -96,6 +97,8 @@ void ExpectDownloadSuccess(const base::Closure& continuation, bool success) {
class FakeUpdateURLFetcherFactory : public net::URLFetcherFactory {
public:
+ FakeUpdateURLFetcherFactory() { EXPECT_TRUE(dir_.CreateUniqueTempDir()); }
+
~FakeUpdateURLFetcherFactory() override {}
void RegisterFakeExtension(const std::string& id,
@@ -156,11 +159,17 @@ class FakeUpdateURLFetcherFactory : public net::URLFetcherFactory {
net::TestURLFetcher* fetcher =
new net::FakeURLFetcher(url, delegate, response.first, response.second,
net::URLRequestStatus::SUCCESS);
- fetcher->SetResponseFilePath(base::FilePath::FromUTF8Unsafe(url.path()));
+ base::FilePath path = dir_.path().Append(
+ base::FilePath::FromUTF8Unsafe(url.path().substr(1)));
+ fetcher->SetResponseFilePath(path);
return scoped_ptr<net::URLFetcher>(fetcher);
}
+ base::ScopedTempDir dir_;
+
std::map<std::string, std::string> fake_extensions_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeUpdateURLFetcherFactory);
};
} // namespace