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

Unified Diff: chrome/test/ppapi/ppapi_test.cc

Issue 10827356: Revert 151716 - Add NaCl smoke test to browser_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/nacl/nacl_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/ppapi/ppapi_test.cc
===================================================================
--- chrome/test/ppapi/ppapi_test.cc (revision 151723)
+++ chrome/test/ppapi/ppapi_test.cc (working copy)
@@ -166,13 +166,13 @@
void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) {
FilePath document_root;
- ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root));
+ ASSERT_TRUE(GetHTTPDocumentRoot(&document_root));
RunHTTPTestServer(document_root, test_case, "");
}
void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) {
FilePath document_root;
- ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root));
+ ASSERT_TRUE(GetHTTPDocumentRoot(&document_root));
net::TestServer test_server(net::BaseTestServer::HTTPSOptions(),
document_root);
ASSERT_TRUE(test_server.Start());
@@ -189,7 +189,7 @@
int port = server.UseRandomPort();
ASSERT_TRUE(server.Start(websocket_root_dir));
FilePath http_document_root;
- ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root));
+ ASSERT_TRUE(GetHTTPDocumentRoot(&http_document_root));
RunHTTPTestServer(http_document_root, test_case,
StringPrintf("websocket_port=%d", port));
}
@@ -256,6 +256,45 @@
RunTestURL(url);
}
+bool PPAPITestBase::GetHTTPDocumentRoot(FilePath* document_root) {
+ // For HTTP tests, we use the output DIR to grab the generated files such
+ // as the NEXEs.
+ FilePath exe_dir = CommandLine::ForCurrentProcess()->GetProgram().DirName();
+ FilePath src_dir;
+ if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir))
+ return false;
+
+ // TestServer expects a path relative to source. So we must first
+ // generate absolute paths to SRC and EXE and from there generate
+ // a relative path.
+ if (!exe_dir.IsAbsolute()) file_util::AbsolutePath(&exe_dir);
+ if (!src_dir.IsAbsolute()) file_util::AbsolutePath(&src_dir);
+ if (!exe_dir.IsAbsolute())
+ return false;
+ if (!src_dir.IsAbsolute())
+ return false;
+
+ size_t match, exe_size, src_size;
+ std::vector<FilePath::StringType> src_parts, exe_parts;
+
+ // Determine point at which src and exe diverge, and create a relative path.
+ exe_dir.GetComponents(&exe_parts);
+ src_dir.GetComponents(&src_parts);
+ exe_size = exe_parts.size();
+ src_size = src_parts.size();
+ for (match = 0; match < exe_size && match < src_size; ++match) {
+ if (exe_parts[match] != src_parts[match])
+ break;
+ }
+ for (size_t tmp_itr = match; tmp_itr < src_size; ++tmp_itr) {
+ *document_root = document_root->Append(FILE_PATH_LITERAL(".."));
+ }
+ for (; match < exe_size; ++match) {
+ *document_root = document_root->Append(exe_parts[match]);
+ }
+ return true;
+}
+
PPAPITest::PPAPITest() {
}
« no previous file with comments | « chrome/test/nacl/nacl_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698