summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 18:54:54 +0000
committertoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-22 18:54:54 +0000
commit967c43ce2e52c96fb6f3a5c878d2973c7bcf2fc1 (patch)
treebbbdb4330b0aa7de3f263efdf7b54af0ddae9217
parent287416dfae42de0b012111699f48e23a6e2f598d (diff)
downloadchromium_src-967c43ce2e52c96fb6f3a5c878d2973c7bcf2fc1.zip
chromium_src-967c43ce2e52c96fb6f3a5c878d2973c7bcf2fc1.tar.gz
chromium_src-967c43ce2e52c96fb6f3a5c878d2973c7bcf2fc1.tar.bz2
ui_tests and browser_tests use layout test data.
They are stored in chrome/test/data/layout_tests/LayoutTests in svn or old git workflow. and in third_party/WebKit/LayoutTests in new git workflow. This change adds new query key chrome::DIR_LAYOUT_TESTS to PathService::Get(). Using this interface, each test easily get suitable path for their layout tests. BUG=105104 TEST=browser_tests; ui_tests Review URL: http://codereview.chromium.org/8641002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111186 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_websocket_apitest.cc5
-rw-r--r--chrome/common/chrome_paths.cc13
-rw-r--r--chrome/common/chrome_paths.h8
-rw-r--r--chrome/test/ui/ui_layout_test.cc31
4 files changed, 27 insertions, 30 deletions
diff --git a/chrome/browser/extensions/extension_websocket_apitest.cc b/chrome/browser/extensions/extension_websocket_apitest.cc
index a617d04..469d059 100644
--- a/chrome/browser/extensions/extension_websocket_apitest.cc
+++ b/chrome/browser/extensions/extension_websocket_apitest.cc
@@ -11,9 +11,8 @@
// Disabled, http://crbug.com/91058.
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WebSocket) {
FilePath websocket_root_dir;
- PathService::Get(chrome::DIR_TEST_DATA, &websocket_root_dir);
- websocket_root_dir = websocket_root_dir.AppendASCII("layout_tests")
- .AppendASCII("LayoutTests");
+ ASSERT_TRUE(PathService::Get(chrome::DIR_LAYOUT_TESTS, &websocket_root_dir));
+
ui_test_utils::TestWebSocketServer server;
ASSERT_TRUE(server.Start(websocket_root_dir));
ASSERT_TRUE(RunExtensionTest("websocket")) << message_;
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index 77d8d38..5af2ce3 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -305,6 +305,19 @@ bool PathProvider(int key, FilePath* result) {
if (!file_util::PathExists(cur)) // We don't want to create this
return false;
break;
+ case chrome::DIR_LAYOUT_TESTS:
+ if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur))
+ return false;
+ cur = cur.Append(FILE_PATH_LITERAL("third_party"));
+ cur = cur.Append(FILE_PATH_LITERAL("WebKit"));
+ cur = cur.Append(FILE_PATH_LITERAL("LayoutTests"));
+ if (file_util::DirectoryExists(cur))
+ break;
+ if (!PathService::Get(chrome::DIR_TEST_DATA, &cur))
+ return false;
+ cur = cur.Append(FILE_PATH_LITERAL("layout_tests"));
+ cur = cur.Append(FILE_PATH_LITERAL("LayoutTests"));
+ break;
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
case chrome::DIR_POLICY_FILES: {
#if defined(GOOGLE_CHROME_BUILD)
diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h
index 4eeeaef..c6edfb3 100644
--- a/chrome/common/chrome_paths.h
+++ b/chrome/common/chrome_paths.h
@@ -100,6 +100,14 @@ enum {
DIR_GEN_TEST_DATA, // Directory where generated test data resides.
DIR_TEST_DATA, // Directory where unit test data resides.
DIR_TEST_TOOLS, // Directory where unit test tools reside.
+ DIR_LAYOUT_TESTS, // Returns the LayoutTests path for layout
+ // tests. For the current git workflow, it
+ // returns
+ // third_party/WebKit/LayoutTests
+ // On svn workflow (including build machines)
+ // and older git workflow, it returns
+ // chrome/test/data/layout_tests/LayoutTests
+ // See, http://crbug.com/105104.
PATH_END
};
diff --git a/chrome/test/ui/ui_layout_test.cc b/chrome/test/ui/ui_layout_test.cc
index 6c0c8c7..349c2ff 100644
--- a/chrome/test/ui/ui_layout_test.cc
+++ b/chrome/test/ui/ui_layout_test.cc
@@ -45,35 +45,11 @@ UILayoutTest::~UILayoutTest() {
}
}
-// Gets layout tests root. For the current git workflow, this is
-// third_party/WebKit/LayoutTests
-// On svn workflow (including build machines) and older git workflow, this is
-// chrome/test/data/layout_tests/LayoutTests
-// This function probes for the first and then fallbacks to the second.
-static FilePath GetLayoutTestRoot() {
- FilePath src_root;
- PathService::Get(base::DIR_SOURCE_ROOT, &src_root);
-
- FilePath webkit_layout_tests = src_root;
- webkit_layout_tests = webkit_layout_tests.AppendASCII("third_party");
- webkit_layout_tests = webkit_layout_tests.AppendASCII("WebKit");
- webkit_layout_tests = webkit_layout_tests.AppendASCII("LayoutTests");
- if (file_util::DirectoryExists(webkit_layout_tests))
- return webkit_layout_tests;
-
- FilePath chrome_layout_tests = src_root;
- chrome_layout_tests = chrome_layout_tests.AppendASCII("chrome");
- chrome_layout_tests = chrome_layout_tests.AppendASCII("test");
- chrome_layout_tests = chrome_layout_tests.AppendASCII("data");
- chrome_layout_tests = chrome_layout_tests.AppendASCII("layout_tests");
- chrome_layout_tests = chrome_layout_tests.AppendASCII("LayoutTests");
- return chrome_layout_tests;
-}
-
void UILayoutTest::InitializeForLayoutTest(const FilePath& test_parent_dir,
const FilePath& test_case_dir,
int port) {
- FilePath src_dir = GetLayoutTestRoot();
+ FilePath src_dir;
+ ASSERT_TRUE(PathService::Get(chrome::DIR_LAYOUT_TESTS, &src_dir));
layout_test_dir_ = src_dir.Append(test_parent_dir);
layout_test_dir_ = layout_test_dir_.Append(test_case_dir);
ASSERT_TRUE(file_util::DirectoryExists(layout_test_dir_));
@@ -155,7 +131,8 @@ void UILayoutTest::InitializeForLayoutTest(const FilePath& test_parent_dir,
void UILayoutTest::AddResourceForLayoutTest(const FilePath& parent_dir,
const FilePath& resource_name) {
- FilePath source = GetLayoutTestRoot();
+ FilePath source;
+ ASSERT_TRUE(PathService::Get(chrome::DIR_LAYOUT_TESTS, &source));
source = source.Append(parent_dir);
source = source.Append(resource_name);