summaryrefslogtreecommitdiffstats
path: root/net/test
diff options
context:
space:
mode:
authorshouqun.liu@intel.com <shouqun.liu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-25 13:17:28 +0000
committershouqun.liu@intel.com <shouqun.liu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-25 13:17:28 +0000
commitb09c0a167416c2763461e5d6a8cb540700bf12fc (patch)
tree8ce55b8c290d3e565c72b04e272bf0f7b9855f24 /net/test
parent32ee872fc57bfab7d14792c1bd120d5b14e39f49 (diff)
downloadchromium_src-b09c0a167416c2763461e5d6a8cb540700bf12fc.zip
chromium_src-b09c0a167416c2763461e5d6a8cb540700bf12fc.tar.gz
chromium_src-b09c0a167416c2763461e5d6a8cb540700bf12fc.tar.bz2
Fix the failed cases in URLFetcherFileTest on Android.
* Push the needed data files to target device. * Set the correct document root. BUG= TEST=net_unittests --gtest_filter=URLFetcherFileTest.* Review URL: https://chromiumcodereview.appspot.com/10986042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/test')
-rw-r--r--net/test/local_test_server.h4
-rw-r--r--net/test/remote_test_server.cc10
-rw-r--r--net/test/remote_test_server.h6
3 files changed, 20 insertions, 0 deletions
diff --git a/net/test/local_test_server.h b/net/test/local_test_server.h
index 2663668..d8d070e 100644
--- a/net/test/local_test_server.h
+++ b/net/test/local_test_server.h
@@ -53,6 +53,10 @@ class LocalTestServer : public BaseTestServer {
// |command_line|. Returns true on success.
virtual bool AddCommandLineArguments(CommandLine* command_line) const;
+ // Returns the actual path of document root for test cases. This function
+ // should be called by test cases to retrieve the actual document root path.
+ FilePath GetDocumentRoot() const { return document_root(); };
+
private:
bool Init(const FilePath& document_root);
diff --git a/net/test/remote_test_server.cc b/net/test/remote_test_server.cc
index 5020ca7..45da5a5 100644
--- a/net/test/remote_test_server.cc
+++ b/net/test/remote_test_server.cc
@@ -143,6 +143,16 @@ bool RemoteTestServer::Stop() {
return stopped;
}
+// On Android, the document root in the device is not the same as the document
+// root in the host machine where the test server is launched. So prepend
+// DIR_SOURCE_ROOT here to get the actual path of document root on the Android
+// device.
+FilePath RemoteTestServer::GetDocumentRoot() const {
+ FilePath src_dir;
+ PathService::Get(base::DIR_SOURCE_ROOT, &src_dir);
+ return src_dir.Append(document_root());
+}
+
bool RemoteTestServer::Init(const FilePath& document_root) {
if (document_root.IsAbsolute())
return false;
diff --git a/net/test/remote_test_server.h b/net/test/remote_test_server.h
index 417eda8b..82ac471 100644
--- a/net/test/remote_test_server.h
+++ b/net/test/remote_test_server.h
@@ -37,6 +37,12 @@ class RemoteTestServer : public BaseTestServer {
// Stops the Python test server that is running on the host machine.
bool Stop();
+ // Returns the actual path of document root for the test cases. This function
+ // should be called by test cases to retrieve the actual document root path
+ // on the Android device, otherwise document_root() function is used to get
+ // the document root.
+ FilePath GetDocumentRoot() const;
+
private:
bool Init(const FilePath& document_root);