| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "content/test/layout_browsertest.h" | 24 #include "content/test/layout_browsertest.h" |
| 25 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" |
| 26 #include "net/base/test_data_directory.h" | 26 #include "net/base/test_data_directory.h" |
| 27 #include "net/test/test_server.h" | 27 #include "net/test/test_server.h" |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| 31 class WorkerLayoutTest : public InProcessBrowserLayoutTest { | 31 class WorkerLayoutTest : public InProcessBrowserLayoutTest { |
| 32 public: | 32 public: |
| 33 WorkerLayoutTest() : InProcessBrowserLayoutTest( | 33 WorkerLayoutTest() : InProcessBrowserLayoutTest( |
| 34 FilePath(), FilePath().AppendASCII("fast").AppendASCII("workers")) { | 34 base::FilePath(), |
| 35 base::FilePath().AppendASCII("fast").AppendASCII("workers")) { |
| 35 } | 36 } |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 // Crashy, http://crbug.com/35965. | 39 // Crashy, http://crbug.com/35965. |
| 39 // Flaky, http://crbug.com/36555. | 40 // Flaky, http://crbug.com/36555. |
| 40 IN_PROC_BROWSER_TEST_F(WorkerLayoutTest, DISABLED_WorkerClonePort) { | 41 IN_PROC_BROWSER_TEST_F(WorkerLayoutTest, DISABLED_WorkerClonePort) { |
| 41 RunLayoutTest("worker-cloneport.html"); | 42 RunLayoutTest("worker-cloneport.html"); |
| 42 } | 43 } |
| 43 | 44 |
| 44 // http://crbug.com/101996 (started flaking with WebKit roll 98537:98582). | 45 // http://crbug.com/101996 (started flaking with WebKit roll 98537:98582). |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 RunLayoutTest("shared-worker-shared.html"); | 120 RunLayoutTest("shared-worker-shared.html"); |
| 120 } | 121 } |
| 121 | 122 |
| 122 IN_PROC_BROWSER_TEST_F(WorkerLayoutTest, SharedWorkerFastSimple) { | 123 IN_PROC_BROWSER_TEST_F(WorkerLayoutTest, SharedWorkerFastSimple) { |
| 123 RunLayoutTest("shared-worker-simple.html"); | 124 RunLayoutTest("shared-worker-simple.html"); |
| 124 } | 125 } |
| 125 | 126 |
| 126 class MessagePortTest : public InProcessBrowserLayoutTest { | 127 class MessagePortTest : public InProcessBrowserLayoutTest { |
| 127 public: | 128 public: |
| 128 MessagePortTest() : InProcessBrowserLayoutTest( | 129 MessagePortTest() : InProcessBrowserLayoutTest( |
| 129 FilePath(), FilePath().AppendASCII("fast").AppendASCII("events")) { | 130 base::FilePath(), |
| 131 base::FilePath().AppendASCII("fast").AppendASCII("events")) { |
| 130 } | 132 } |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 // Flaky, http://crbug.com/34996. | 135 // Flaky, http://crbug.com/34996. |
| 134 IN_PROC_BROWSER_TEST_F(MessagePortTest, Tests) { | 136 IN_PROC_BROWSER_TEST_F(MessagePortTest, Tests) { |
| 135 static const char* kLayoutTestFiles[] = { | 137 static const char* kLayoutTestFiles[] = { |
| 136 "message-channel-gc.html", | 138 "message-channel-gc.html", |
| 137 "message-channel-gc-2.html", | 139 "message-channel-gc-2.html", |
| 138 "message-channel-gc-3.html", | 140 "message-channel-gc-3.html", |
| 139 "message-channel-gc-4.html", | 141 "message-channel-gc-4.html", |
| (...skipping 13 matching lines...) Expand all Loading... |
| 153 RunLayoutTest(kLayoutTestFiles[i]); | 155 RunLayoutTest(kLayoutTestFiles[i]); |
| 154 } | 156 } |
| 155 | 157 |
| 156 | 158 |
| 157 class WorkerHttpLayoutTest : public InProcessBrowserLayoutTest { | 159 class WorkerHttpLayoutTest : public InProcessBrowserLayoutTest { |
| 158 public: | 160 public: |
| 159 // The resources for these tests hardcode 8000, so must use that here. If | 161 // The resources for these tests hardcode 8000, so must use that here. If |
| 160 // multiple tests which use it run in parallel, then the test will fail but | 162 // multiple tests which use it run in parallel, then the test will fail but |
| 161 // it'll run again at the end in serial and pass. | 163 // it'll run again at the end in serial and pass. |
| 162 WorkerHttpLayoutTest() : InProcessBrowserLayoutTest( | 164 WorkerHttpLayoutTest() : InProcessBrowserLayoutTest( |
| 163 FilePath().AppendASCII("http").AppendASCII("tests"), | 165 base::FilePath().AppendASCII("http").AppendASCII("tests"), |
| 164 FilePath().AppendASCII("workers"), | 166 base::FilePath().AppendASCII("workers"), |
| 165 8000) { | 167 8000) { |
| 166 } | 168 } |
| 167 }; | 169 }; |
| 168 | 170 |
| 169 // http://crbug.com/16934 | 171 // http://crbug.com/16934 |
| 170 IN_PROC_BROWSER_TEST_F(WorkerHttpLayoutTest, DISABLED_Tests) { | 172 IN_PROC_BROWSER_TEST_F(WorkerHttpLayoutTest, DISABLED_Tests) { |
| 171 static const char* kLayoutTestFiles[] = { | 173 static const char* kLayoutTestFiles[] = { |
| 172 "shared-worker-importScripts.html", | 174 "shared-worker-importScripts.html", |
| 173 "shared-worker-redirect.html", | 175 "shared-worker-redirect.html", |
| 174 "text-encoding.html", | 176 "text-encoding.html", |
| 175 #if defined(OS_WIN) | 177 #if defined(OS_WIN) |
| 176 // Fails on the mac (and linux?): | 178 // Fails on the mac (and linux?): |
| 177 // http://code.google.com/p/chromium/issues/detail?id=22599 | 179 // http://code.google.com/p/chromium/issues/detail?id=22599 |
| 178 "worker-importScripts.html", | 180 "worker-importScripts.html", |
| 179 #endif | 181 #endif |
| 180 "worker-redirect.html", | 182 "worker-redirect.html", |
| 181 }; | 183 }; |
| 182 | 184 |
| 183 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) | 185 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) |
| 184 RunHttpLayoutTest(kLayoutTestFiles[i]); | 186 RunHttpLayoutTest(kLayoutTestFiles[i]); |
| 185 } | 187 } |
| 186 | 188 |
| 187 class WorkerXHRHttpLayoutTest : public InProcessBrowserLayoutTest { | 189 class WorkerXHRHttpLayoutTest : public InProcessBrowserLayoutTest { |
| 188 public: | 190 public: |
| 189 WorkerXHRHttpLayoutTest() : InProcessBrowserLayoutTest( | 191 WorkerXHRHttpLayoutTest() : InProcessBrowserLayoutTest( |
| 190 FilePath().AppendASCII("http").AppendASCII("tests"), | 192 base::FilePath().AppendASCII("http").AppendASCII("tests"), |
| 191 FilePath().AppendASCII("xmlhttprequest").AppendASCII("workers"), | 193 base::FilePath().AppendASCII("xmlhttprequest").AppendASCII("workers"), |
| 192 -1) { | 194 -1) { |
| 193 } | 195 } |
| 194 }; | 196 }; |
| 195 | 197 |
| 196 IN_PROC_BROWSER_TEST_F(WorkerXHRHttpLayoutTest, Tests) { | 198 IN_PROC_BROWSER_TEST_F(WorkerXHRHttpLayoutTest, Tests) { |
| 197 static const char* kLayoutTestFiles[] = { | 199 static const char* kLayoutTestFiles[] = { |
| 198 // worker thread count never drops to zero. | 200 // worker thread count never drops to zero. |
| 199 // http://crbug.com/150565 | 201 // http://crbug.com/150565 |
| 200 // "abort-exception-assert.html", | 202 // "abort-exception-assert.html", |
| 201 #if defined(OS_WIN) | 203 #if defined(OS_WIN) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 220 | 222 |
| 221 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) | 223 for (size_t i = 0; i < arraysize(kLayoutTestFiles); ++i) |
| 222 RunHttpLayoutTest(kLayoutTestFiles[i]); | 224 RunHttpLayoutTest(kLayoutTestFiles[i]); |
| 223 } | 225 } |
| 224 | 226 |
| 225 class WorkerTest : public ContentBrowserTest { | 227 class WorkerTest : public ContentBrowserTest { |
| 226 public: | 228 public: |
| 227 WorkerTest() {} | 229 WorkerTest() {} |
| 228 | 230 |
| 229 GURL GetTestURL(const std::string& test_case, const std::string& query) { | 231 GURL GetTestURL(const std::string& test_case, const std::string& query) { |
| 230 FilePath test_file_path = GetTestFilePath( | 232 base::FilePath test_file_path = GetTestFilePath( |
| 231 "workers", test_case.c_str()); | 233 "workers", test_case.c_str()); |
| 232 return GetFileUrlWithQuery(test_file_path, query); | 234 return GetFileUrlWithQuery(test_file_path, query); |
| 233 } | 235 } |
| 234 | 236 |
| 235 void RunTest(Shell* window, | 237 void RunTest(Shell* window, |
| 236 const std::string& test_case, | 238 const std::string& test_case, |
| 237 const std::string& query) { | 239 const std::string& query) { |
| 238 GURL url = GetTestURL(test_case, query); | 240 GURL url = GetTestURL(test_case, query); |
| 239 const string16 expected_title = ASCIIToUTF16("OK"); | 241 const string16 expected_title = ASCIIToUTF16("OK"); |
| 240 TitleWatcher title_watcher(window->web_contents(), expected_title); | 242 TitleWatcher title_watcher(window->web_contents(), expected_title); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // Run test. | 467 // Run test. |
| 466 Shell* window = shell(); | 468 Shell* window = shell(); |
| 467 const string16 expected_title = ASCIIToUTF16("OK"); | 469 const string16 expected_title = ASCIIToUTF16("OK"); |
| 468 TitleWatcher title_watcher(window->web_contents(), expected_title); | 470 TitleWatcher title_watcher(window->web_contents(), expected_title); |
| 469 NavigateToURL(window, url); | 471 NavigateToURL(window, url); |
| 470 string16 final_title = title_watcher.WaitAndGetTitle(); | 472 string16 final_title = title_watcher.WaitAndGetTitle(); |
| 471 EXPECT_EQ(expected_title, final_title); | 473 EXPECT_EQ(expected_title, final_title); |
| 472 } | 474 } |
| 473 | 475 |
| 474 } // namespace content | 476 } // namespace content |
| OLD | NEW |