summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEPS3
-rw-r--r--chrome/browser/appcache/appcache_ui_test.cc75
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/test/data/layout_tests/layout_test_controller.html2
-rw-r--r--chrome/test/ui/ui_layout_test.cc17
5 files changed, 94 insertions, 4 deletions
diff --git a/DEPS b/DEPS
index 0458472..80ff669 100644
--- a/DEPS
+++ b/DEPS
@@ -127,6 +127,9 @@ deps = {
"src/chrome/test/data/layout_tests/LayoutTests/platform/chromium-win/fast/workers":
Var("webkit_trunk") + "/LayoutTests/platform/chromium-win/fast/workers@" +
Var("webkit_revision"),
+ "src/chrome/test/data/layout_tests/LayoutTests/http/tests/appcache":
+ Var("webkit_trunk") + "/LayoutTests/http/tests/appcache@" +
+ Var("webkit_revision"),
"src/chrome/test/data/layout_tests/LayoutTests/platform/chromium-win/http/tests/workers":
Var("webkit_trunk") + "/LayoutTests/platform/chromium-win/http/tests/workers@" +
Var("webkit_revision"),
diff --git a/chrome/browser/appcache/appcache_ui_test.cc b/chrome/browser/appcache/appcache_ui_test.cc
new file mode 100644
index 0000000..23afd8b
--- /dev/null
+++ b/chrome/browser/appcache/appcache_ui_test.cc
@@ -0,0 +1,75 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/file_path.h"
+#include "chrome/test/ui/ui_layout_test.h"
+
+class AppCacheUITest : public UILayoutTest {
+ protected:
+ virtual ~AppCacheUITest() {}
+};
+
+TEST_F(AppCacheUITest, FLAKY_AppCacheLayoutTests) {
+ static const char* kLayoutTestFiles[] = {
+ "404-manifest.html",
+ "404-resource.html",
+ "auth.html",
+ "cyrillic-uri.html",
+ "deferred-events-delete-while-raising.html",
+ "deferred-events.html",
+ "destroyed-frame.html",
+ "detached-iframe.html",
+ "different-origin-manifest.html",
+ "different-scheme.html",
+ "empty-manifest.html",
+ "fallback.html",
+ "foreign-iframe-main.html",
+ "main-resource-hash.html",
+ "manifest-containing-itself.html",
+ "manifest-parsing.html",
+ "manifest-redirect-2.html",
+ "manifest-redirect.html",
+ "manifest-with-empty-file.html",
+ "navigating-away-while-cache-attempt-in-progress.html",
+ "offline-access.html",
+ "online-whitelist.html",
+ "reload.html",
+ "remove-cache.html",
+ "resource-redirect-2.html",
+ "resource-redirect.html",
+ "simple.html",
+ "top-frame-1.html",
+ "top-frame-2.html",
+ "top-frame-3.html",
+ "top-frame-4.html",
+ "whitelist-wildcard.html",
+ "wrong-content-type.html",
+ "wrong-signature-2.html",
+ "wrong-signature.html",
+ "xhr-foreign-resource.html",
+
+ // TOOD(michaeln): investigate these more closely
+ // "crash-when-navigating-away-then-back.html",
+ // "credential-url.html",
+ // "different-https-origin-resource-main.html",
+ // "fail-on-update.html",
+ // "idempotent-update.html", not sure this is a valid test
+ // "local-content.html",
+ // "max-size.html", we use a different quota scheme
+ // "update-cache.html", bug 38006
+ };
+
+ FilePath http_test_dir;
+ http_test_dir = http_test_dir.AppendASCII("http");
+ http_test_dir = http_test_dir.AppendASCII("tests");
+
+ FilePath appcache_test_dir;
+ appcache_test_dir = appcache_test_dir.AppendASCII("appcache");
+ InitializeForLayoutTest(http_test_dir, appcache_test_dir, kHttpPort);
+
+ StartHttpServer(new_http_root_dir_);
+ for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i)
+ RunLayoutTest(kLayoutTestFiles[i], kHttpPort);
+ StopHttpServer();
+}
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index ee8e88a..e956ce6 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -302,6 +302,7 @@
],
'sources': [
'app/chrome_main_uitest.cc',
+ 'browser/appcache/appcache_ui_test.cc',
'browser/browser_encoding_uitest.cc',
'browser/browser_uitest.cc',
'browser/cookie_modal_dialog_uitest.cc',
diff --git a/chrome/test/data/layout_tests/layout_test_controller.html b/chrome/test/data/layout_tests/layout_test_controller.html
index e82d675..e2bf813 100644
--- a/chrome/test/data/layout_tests/layout_test_controller.html
+++ b/chrome/test/data/layout_tests/layout_test_controller.html
@@ -22,7 +22,7 @@ function LayoutTestController() {
};
this.DelayedNotifyDone2 = function () {
- var token = encodeURIComponent(document.firstChild.innerText);
+ var token = encodeURIComponent(document.body.innerText);
document.cookie = "%COOKIE%=" + token;
};
diff --git a/chrome/test/ui/ui_layout_test.cc b/chrome/test/ui/ui_layout_test.cc
index 73556a9..6c5415f 100644
--- a/chrome/test/ui/ui_layout_test.cc
+++ b/chrome/test/ui/ui_layout_test.cc
@@ -156,6 +156,16 @@ void UILayoutTest::AddResourceForLayoutTest(const FilePath& parent_dir,
ASSERT_TRUE(file_util::CopyDirectory(src_dir, dest_dir, true));
}
+static size_t FindInsertPosition(const std::string& html) {
+ size_t tag_start = html.find("<html");
+ if (tag_start == std::string::npos)
+ return 0;
+ size_t tag_end = html.find(">", tag_start);
+ if (tag_end == std::string::npos)
+ return 0;
+ return tag_end + 1;
+}
+
void UILayoutTest::RunLayoutTest(const std::string& test_case_file_name,
int port) {
SCOPED_TRACE(test_case_file_name.c_str());
@@ -175,9 +185,10 @@ void UILayoutTest::RunLayoutTest(const std::string& test_case_file_name,
ASSERT_TRUE(file_util::ReadFileToString(test_file_path, &test_html));
// Injects the layout test controller into the test HTML.
- test_html.insert(0, layout_test_controller_);
- ReplaceSubstringsAfterOffset(
- &test_html, 0, "%COOKIE%", status_cookie.c_str());
+ size_t insertion_position = FindInsertPosition(test_html);
+ test_html.insert(insertion_position, layout_test_controller_);
+ ReplaceFirstSubstringAfterOffset(
+ &test_html, insertion_position, "%COOKIE%", status_cookie.c_str());
// Creates the new layout test HTML file.
FilePath new_test_file_path(new_layout_test_dir_);