| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file tests that Service Workers (a Content feature) work in the Chromium | 5 // This file tests that Service Workers (a Content feature) work in the Chromium |
| 6 // embedder. | 6 // embedder. |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "build/build_config.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
| 24 #include "content/public/browser/render_frame_host.h" | 25 #include "content/public/browser/render_frame_host.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 content::TitleWatcher title_watcher( | 209 content::TitleWatcher title_watcher( |
| 209 browser()->tab_strip_model()->GetActiveWebContents(), expected_title); | 210 browser()->tab_strip_model()->GetActiveWebContents(), expected_title); |
| 210 ui_test_utils::NavigateToURL(browser(), | 211 ui_test_utils::NavigateToURL(browser(), |
| 211 embedded_test_server()->GetURL("/test.html")); | 212 embedded_test_server()->GetURL("/test.html")); |
| 212 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 213 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 213 } | 214 } |
| 214 | 215 |
| 215 DISALLOW_COPY_AND_ASSIGN(ChromeServiceWorkerFetchTest); | 216 DISALLOW_COPY_AND_ASSIGN(ChromeServiceWorkerFetchTest); |
| 216 }; | 217 }; |
| 217 | 218 |
| 218 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchTest, EmbedPdfSameOrigin) { | 219 // Flaky on Windows; https://crbug.com/628898. |
| 220 #if defined(OS_WIN) |
| 221 #define MAYBE_EmbedPdfSameOrigin DISABLED_EmbedPdfSameOrigin |
| 222 #else |
| 223 #define MAYBE_EmbedPdfSameOrigin EmbedPdfSameOrigin |
| 224 #endif |
| 225 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchTest, MAYBE_EmbedPdfSameOrigin) { |
| 219 // <embed src="test.pdf"> | 226 // <embed src="test.pdf"> |
| 220 const std::string result(ExecuteScriptAndExtractString( | 227 const std::string result(ExecuteScriptAndExtractString( |
| 221 "var embed = document.createElement('embed');" | 228 "var embed = document.createElement('embed');" |
| 222 "embed.src = 'test.pdf';" | 229 "embed.src = 'test.pdf';" |
| 223 "document.body.appendChild(embed);")); | 230 "document.body.appendChild(embed);")); |
| 224 EXPECT_EQ(RequestString(GetURL("/test.pdf"), "no-cors", "include"), result); | 231 EXPECT_EQ(RequestString(GetURL("/test.pdf"), "no-cors", "include"), result); |
| 225 } | 232 } |
| 226 | 233 |
| 227 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchTest, EmbedPdfOtherOrigin) { | 234 // Flaky on Windows; https://crbug.com/628898. |
| 235 #if defined(OS_WIN) |
| 236 #define MAYBE_EmbedPdfOtherOrigin DISABLED_EmbedPdfOtherOrigin |
| 237 #else |
| 238 #define MAYBE_EmbedPdfOtherOrigin EmbedPdfOtherOrigin |
| 239 #endif |
| 240 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchTest, |
| 241 MAYBE_EmbedPdfOtherOrigin) { |
| 228 // <embed src="https://www.example.com/test.pdf"> | 242 // <embed src="https://www.example.com/test.pdf"> |
| 229 const std::string result(ExecuteScriptAndExtractString( | 243 const std::string result(ExecuteScriptAndExtractString( |
| 230 "var embed = document.createElement('embed');" | 244 "var embed = document.createElement('embed');" |
| 231 "embed.src = 'https://www.example.com/test.pdf';" | 245 "embed.src = 'https://www.example.com/test.pdf';" |
| 232 "document.body.appendChild(embed);")); | 246 "document.body.appendChild(embed);")); |
| 233 EXPECT_EQ( | 247 EXPECT_EQ( |
| 234 RequestString("https://www.example.com/test.pdf", "no-cors", "include"), | 248 RequestString("https://www.example.com/test.pdf", "no-cors", "include"), |
| 235 result); | 249 result); |
| 236 } | 250 } |
| 237 | 251 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 ExecutePNACLUrlLoaderTest("OtherCredentials")); | 506 ExecutePNACLUrlLoaderTest("OtherCredentials")); |
| 493 } | 507 } |
| 494 | 508 |
| 495 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, | 509 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, |
| 496 OtherOriginCORSCredentials) { | 510 OtherOriginCORSCredentials) { |
| 497 EXPECT_EQ(GetRequestStringForPNACL(), | 511 EXPECT_EQ(GetRequestStringForPNACL(), |
| 498 ExecutePNACLUrlLoaderTest("OtherCORSCredentials")); | 512 ExecutePNACLUrlLoaderTest("OtherCORSCredentials")); |
| 499 } | 513 } |
| 500 | 514 |
| 501 } // namespace | 515 } // namespace |
| OLD | NEW |