Commit e8d05dc6 authored by dgrogan@chromium.org's avatar dgrogan@chromium.org

It can now be used in content without a layering violation.

This was discussed in https://chromiumcodereview.appspot.com/9693065/#msg11

BUG=
TEST=


Review URL: http://codereview.chromium.org/9820005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128155 0039d316-1c4b-4281-b951-d872f2087c98
parent a3edc2a9
...@@ -195,55 +195,55 @@ deps = { ...@@ -195,55 +195,55 @@ deps = {
# We run these layout tests as UI tests. Since many of the buildbots that # We run these layout tests as UI tests. Since many of the buildbots that
# run layout tests do NOT have access to the LayoutTest directory, we need # run layout tests do NOT have access to the LayoutTest directory, we need
# to map them here. In practice, these do not take up much space. # to map them here. In practice, these do not take up much space.
"src/chrome/test/data/layout_tests/LayoutTests/fast/events": "src/content/test/data/layout_tests/LayoutTests/fast/events":
Var("webkit_trunk") + "/LayoutTests/fast/events@" + Var("webkit_trunk") + "/LayoutTests/fast/events@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/fast/js/resources": "src/content/test/data/layout_tests/LayoutTests/fast/js/resources":
Var("webkit_trunk") + "/LayoutTests/fast/js/resources@" + Var("webkit_trunk") + "/LayoutTests/fast/js/resources@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/fast/workers": "src/content/test/data/layout_tests/LayoutTests/fast/workers":
Var("webkit_trunk") + "/LayoutTests/fast/workers@" + Var("webkit_trunk") + "/LayoutTests/fast/workers@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/http/tests/resources": "src/content/test/data/layout_tests/LayoutTests/http/tests/resources":
Var("webkit_trunk") + "/LayoutTests/http/tests/resources@" + Var("webkit_trunk") + "/LayoutTests/http/tests/resources@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/http/tests/workers": "src/content/test/data/layout_tests/LayoutTests/http/tests/workers":
Var("webkit_trunk") + "/LayoutTests/http/tests/workers@" + Var("webkit_trunk") + "/LayoutTests/http/tests/workers@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/http/tests/xmlhttprequest": "src/content/test/data/layout_tests/LayoutTests/http/tests/xmlhttprequest":
Var("webkit_trunk") + "/LayoutTests/http/tests/xmlhttprequest@" + Var("webkit_trunk") + "/LayoutTests/http/tests/xmlhttprequest@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/http/tests/websocket/tests": "src/content/test/data/layout_tests/LayoutTests/http/tests/websocket/tests":
Var("webkit_trunk") + "/LayoutTests/http/tests/websocket/tests@" + Var("webkit_trunk") + "/LayoutTests/http/tests/websocket/tests@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/platform/chromium/fast/workers": "src/content/test/data/layout_tests/LayoutTests/platform/chromium/fast/workers":
Var("webkit_trunk") + "/LayoutTests/platform/chromium/fast/workers@" + Var("webkit_trunk") + "/LayoutTests/platform/chromium/fast/workers@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/platform/chromium-win/fast/events": "src/content/test/data/layout_tests/LayoutTests/platform/chromium-win/fast/events":
Var("webkit_trunk") + "/LayoutTests/platform/chromium-win/fast/events@" + Var("webkit_trunk") + "/LayoutTests/platform/chromium-win/fast/events@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/platform/chromium-win/fast/workers": "src/content/test/data/layout_tests/LayoutTests/platform/chromium-win/fast/workers":
Var("webkit_trunk") + "/LayoutTests/platform/chromium-win/fast/workers@" + Var("webkit_trunk") + "/LayoutTests/platform/chromium-win/fast/workers@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/http/tests/appcache": "src/content/test/data/layout_tests/LayoutTests/http/tests/appcache":
Var("webkit_trunk") + "/LayoutTests/http/tests/appcache@" + Var("webkit_trunk") + "/LayoutTests/http/tests/appcache@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/platform/chromium-win/http/tests/workers": "src/content/test/data/layout_tests/LayoutTests/platform/chromium-win/http/tests/workers":
Var("webkit_trunk") + "/LayoutTests/platform/chromium-win/http/tests/workers@" + Var("webkit_trunk") + "/LayoutTests/platform/chromium-win/http/tests/workers@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/platform/chromium-win/storage/domstorage": "src/content/test/data/layout_tests/LayoutTests/platform/chromium-win/storage/domstorage":
Var("webkit_trunk") + "/LayoutTests/platform/chromium-win/storage/domstorage@" + Var("webkit_trunk") + "/LayoutTests/platform/chromium-win/storage/domstorage@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/storage/domstorage": "src/content/test/data/layout_tests/LayoutTests/storage/domstorage":
Var("webkit_trunk") + "/LayoutTests/storage/domstorage@" + Var("webkit_trunk") + "/LayoutTests/storage/domstorage@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/storage/indexeddb": "src/content/test/data/layout_tests/LayoutTests/storage/indexeddb":
Var("webkit_trunk") + "/LayoutTests/storage/indexeddb@" + Var("webkit_trunk") + "/LayoutTests/storage/indexeddb@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/fast/filesystem/resources": "src/content/test/data/layout_tests/LayoutTests/fast/filesystem/resources":
Var("webkit_trunk") + "/LayoutTests/fast/filesystem/resources@" + Var("webkit_trunk") + "/LayoutTests/fast/filesystem/resources@" +
Var("webkit_revision"), Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/media": "src/content/test/data/layout_tests/LayoutTests/media":
Var("webkit_trunk") + "/LayoutTests/media@" + Var("webkit_trunk") + "/LayoutTests/media@" +
Var("webkit_revision"), Var("webkit_revision"),
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
#include "base/path_service.h" #include "base/path_service.h"
#include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_paths.h" #include "content/public/common/content_paths.h"
#include "net/base/mock_host_resolver.h" #include "net/base/mock_host_resolver.h"
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebSocket) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebSocket) {
FilePath websocket_root_dir; FilePath websocket_root_dir;
ASSERT_TRUE(PathService::Get(chrome::DIR_LAYOUT_TESTS, &websocket_root_dir)); ASSERT_TRUE(PathService::Get(content::DIR_LAYOUT_TESTS, &websocket_root_dir));
ASSERT_TRUE(StartWebSocketServer(websocket_root_dir)); ASSERT_TRUE(StartWebSocketServer(websocket_root_dir));
ASSERT_TRUE(RunExtensionTest("websocket")) << message_; ASSERT_TRUE(RunExtensionTest("websocket")) << message_;
} }
...@@ -334,19 +334,6 @@ bool PathProvider(int key, FilePath* result) { ...@@ -334,19 +334,6 @@ bool PathProvider(int key, FilePath* result) {
if (!file_util::PathExists(cur)) // We don't want to create this if (!file_util::PathExists(cur)) // We don't want to create this
return false; return false;
break; 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) #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
case chrome::DIR_POLICY_FILES: { case chrome::DIR_POLICY_FILES: {
#if defined(GOOGLE_CHROME_BUILD) #if defined(GOOGLE_CHROME_BUILD)
......
...@@ -104,14 +104,6 @@ enum { ...@@ -104,14 +104,6 @@ enum {
DIR_GEN_TEST_DATA, // Directory where generated test data resides. DIR_GEN_TEST_DATA, // Directory where generated test data resides.
DIR_TEST_DATA, // Directory where unit test data resides. DIR_TEST_DATA, // Directory where unit test data resides.
DIR_TEST_TOOLS, // Directory where unit test tools reside. 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 PATH_END
}; };
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "base/path_service.h" #include "base/path_service.h"
#include "base/process_util.h" #include "base/process_util.h"
#include "base/string_number_conversions.h" #include "base/string_number_conversions.h"
#include "chrome/common/chrome_paths.h" #include "content/public/common/content_paths.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
...@@ -65,7 +65,7 @@ bool LayoutTestHttpServer::Start() { ...@@ -65,7 +65,7 @@ bool LayoutTestHttpServer::Start() {
cmd_line.AppendArg("--port=" + base::IntToString(port_)); cmd_line.AppendArg("--port=" + base::IntToString(port_));
FilePath layout_tests_dir; FilePath layout_tests_dir;
if (!PathService::Get(chrome::DIR_LAYOUT_TESTS, &layout_tests_dir)) if (!PathService::Get(content::DIR_LAYOUT_TESTS, &layout_tests_dir))
return false; return false;
cmd_line.AppendArgNative(FILE_PATH_LITERAL("--layout_tests_dir=") + cmd_line.AppendArgNative(FILE_PATH_LITERAL("--layout_tests_dir=") +
layout_tests_dir.value()); layout_tests_dir.value());
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "content/public/browser/dom_operation_notification_details.h" #include "content/public/browser/dom_operation_notification_details.h"
#include "content/public/browser/notification_types.h" #include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
...@@ -206,7 +207,7 @@ void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { ...@@ -206,7 +207,7 @@ void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) {
void PPAPITestBase::RunTestWithWebSocketServer(const std::string& test_case) { void PPAPITestBase::RunTestWithWebSocketServer(const std::string& test_case) {
FilePath websocket_root_dir; FilePath websocket_root_dir;
ASSERT_TRUE( ASSERT_TRUE(
PathService::Get(chrome::DIR_LAYOUT_TESTS, &websocket_root_dir)); PathService::Get(content::DIR_LAYOUT_TESTS, &websocket_root_dir));
ui_test_utils::TestWebSocketServer server; ui_test_utils::TestWebSocketServer server;
int port = server.UseRandomPort(); int port = server.UseRandomPort();
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "base/test/test_file_util.h" #include "base/test/test_file_util.h"
#include "base/test/test_timeouts.h" #include "base/test/test_timeouts.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h" #include "content/public/common/content_paths.h"
#include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/tab_proxy.h"
#include "net/base/escape.h" #include "net/base/escape.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
...@@ -50,10 +50,11 @@ void UILayoutTest::InitializeForLayoutTest(const FilePath& test_parent_dir, ...@@ -50,10 +50,11 @@ void UILayoutTest::InitializeForLayoutTest(const FilePath& test_parent_dir,
const FilePath& test_case_dir, const FilePath& test_case_dir,
int port) { int port) {
FilePath src_dir; FilePath src_dir;
ASSERT_TRUE(PathService::Get(chrome::DIR_LAYOUT_TESTS, &src_dir)); ASSERT_TRUE(PathService::Get(content::DIR_LAYOUT_TESTS, &src_dir));
layout_test_dir_ = src_dir.Append(test_parent_dir); layout_test_dir_ = src_dir.Append(test_parent_dir);
layout_test_dir_ = layout_test_dir_.Append(test_case_dir); layout_test_dir_ = layout_test_dir_.Append(test_case_dir);
ASSERT_TRUE(file_util::DirectoryExists(layout_test_dir_)); ASSERT_TRUE(file_util::DirectoryExists(layout_test_dir_))
<< " " << layout_test_dir_.value();
// Gets the file path to rebased expected result directory for the current // Gets the file path to rebased expected result directory for the current
// platform. // platform.
...@@ -123,7 +124,7 @@ void UILayoutTest::InitializeForLayoutTest(const FilePath& test_parent_dir, ...@@ -123,7 +124,7 @@ void UILayoutTest::InitializeForLayoutTest(const FilePath& test_parent_dir,
// Reads the layout test controller simulation script. // Reads the layout test controller simulation script.
FilePath path; FilePath path;
PathService::Get(chrome::DIR_TEST_DATA, &path); PathService::Get(content::DIR_TEST_DATA, &path);
path = path.AppendASCII("layout_tests"); path = path.AppendASCII("layout_tests");
path = path.AppendASCII("layout_test_controller.html"); path = path.AppendASCII("layout_test_controller.html");
layout_test_controller_.clear(); layout_test_controller_.clear();
...@@ -133,11 +134,11 @@ void UILayoutTest::InitializeForLayoutTest(const FilePath& test_parent_dir, ...@@ -133,11 +134,11 @@ void UILayoutTest::InitializeForLayoutTest(const FilePath& test_parent_dir,
void UILayoutTest::AddResourceForLayoutTest(const FilePath& parent_dir, void UILayoutTest::AddResourceForLayoutTest(const FilePath& parent_dir,
const FilePath& resource_name) { const FilePath& resource_name) {
FilePath source; FilePath source;
ASSERT_TRUE(PathService::Get(chrome::DIR_LAYOUT_TESTS, &source)); ASSERT_TRUE(PathService::Get(content::DIR_LAYOUT_TESTS, &source));
source = source.Append(parent_dir); source = source.Append(parent_dir);
source = source.Append(resource_name); source = source.Append(resource_name);
ASSERT_TRUE(file_util::PathExists(source)); ASSERT_TRUE(file_util::PathExists(source)) << " " << source.value();
FilePath dest_parent_dir = temp_test_dir_. FilePath dest_parent_dir = temp_test_dir_.
AppendASCII("LayoutTests").Append(parent_dir); AppendASCII("LayoutTests").Append(parent_dir);
......
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
#include "base/file_path.h" #include "base/file_path.h"
#include "base/file_util.h" #include "base/file_util.h"
#include "base/path_service.h"
#include "base/test/test_timeouts.h" #include "base/test/test_timeouts.h"
#include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/ui/ui_layout_test.h" #include "chrome/test/ui/ui_layout_test.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
#include "webkit/dom_storage/dom_storage_types.h" #include "webkit/dom_storage/dom_storage_types.h"
...@@ -78,9 +79,11 @@ class DOMStorageTest : public UILayoutTest { ...@@ -78,9 +79,11 @@ class DOMStorageTest : public UILayoutTest {
scoped_refptr<TabProxy> tab(GetActiveTab()); scoped_refptr<TabProxy> tab(GetActiveTab());
ASSERT_TRUE(tab.get()); ASSERT_TRUE(tab.get());
const FilePath dir(FILE_PATH_LITERAL("layout_tests")); FilePath dir;
const FilePath file(FILE_PATH_LITERAL("clear_dom_storage.html")); PathService::Get(content::DIR_TEST_DATA, &dir);
GURL url = ui_test_utils::GetTestUrl(dir, file); GURL url = net::FilePathToFileURL(
dir.AppendASCII("layout_tests").AppendASCII("clear_dom_storage.html"));
ASSERT_TRUE(tab->SetCookie(url, "")); ASSERT_TRUE(tab->SetCookie(url, ""));
ASSERT_TRUE(tab->NavigateToURL(url)); ASSERT_TRUE(tab->NavigateToURL(url));
......
...@@ -37,6 +37,24 @@ bool PathProvider(int key, FilePath* result) { ...@@ -37,6 +37,24 @@ bool PathProvider(int key, FilePath* result) {
return PathService::Get(base::DIR_MODULE, result); return PathService::Get(base::DIR_MODULE, result);
#endif #endif
} }
case DIR_LAYOUT_TESTS: {
FilePath cur;
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)) {
*result = cur;
return true;
}
if (!PathService::Get(DIR_TEST_DATA, &cur))
return false;
cur = cur.Append(FILE_PATH_LITERAL("layout_tests"));
cur = cur.Append(FILE_PATH_LITERAL("LayoutTests"));
*result = cur;
return true;
}
default: default:
return false; return false;
} }
......
...@@ -24,6 +24,14 @@ enum { ...@@ -24,6 +24,14 @@ enum {
// Directory where the Media libraries reside. // Directory where the Media libraries reside.
DIR_MEDIA_LIBS, DIR_MEDIA_LIBS,
// 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
// content/test/data/layout_tests/LayoutTests
// See http://crbug.com/105104.
DIR_LAYOUT_TESTS,
PATH_END PATH_END
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment