| 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" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 private: | 266 private: |
| 267 void ExecuteJavaScriptForTests(const std::string& js) { | 267 void ExecuteJavaScriptForTests(const std::string& js) { |
| 268 browser() | 268 browser() |
| 269 ->tab_strip_model() | 269 ->tab_strip_model() |
| 270 ->GetActiveWebContents() | 270 ->GetActiveWebContents() |
| 271 ->GetMainFrame() | 271 ->GetMainFrame() |
| 272 ->ExecuteJavaScriptForTests(base::ASCIIToUTF16(js)); | 272 ->ExecuteJavaScriptForTests(base::ASCIIToUTF16(js)); |
| 273 } | 273 } |
| 274 | 274 |
| 275 std::string RequestAppBannerAndGetIssuedRequests() { | 275 std::string RequestAppBannerAndGetIssuedRequests() { |
| 276 browser()->RequestAppBannerFromDevTools( | 276 EXPECT_TRUE(browser()->RequestAppBanner( |
| 277 browser()->tab_strip_model()->GetActiveWebContents()); | 277 browser()->tab_strip_model()->GetActiveWebContents())); |
| 278 return ExecuteScriptAndExtractString( | 278 return ExecuteScriptAndExtractString( |
| 279 "if (issuedRequests.length != 0) reportRequests();" | 279 "if (issuedRequests.length != 0) reportRequests();" |
| 280 "else reportOnFetch = true;"); | 280 "else reportOnFetch = true;"); |
| 281 } | 281 } |
| 282 DISALLOW_COPY_AND_ASSIGN(ChromeServiceWorkerManifestFetchTest); | 282 DISALLOW_COPY_AND_ASSIGN(ChromeServiceWorkerManifestFetchTest); |
| 283 }; | 283 }; |
| 284 | 284 |
| 285 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerManifestFetchTest, SameOrigin) { | 285 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerManifestFetchTest, SameOrigin) { |
| 286 // <link rel="manifest" href="manifest.json"> | 286 // <link rel="manifest" href="manifest.json"> |
| 287 EXPECT_EQ(RequestString(GetURL("/manifest.json"), "cors", "same-origin"), | 287 EXPECT_EQ(RequestString(GetURL("/manifest.json"), "cors", "same-origin"), |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 ExecutePNACLUrlLoaderTest("OtherCredentials")); | 492 ExecutePNACLUrlLoaderTest("OtherCredentials")); |
| 493 } | 493 } |
| 494 | 494 |
| 495 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, | 495 IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerFetchPPAPIPrivateTest, |
| 496 OtherOriginCORSCredentials) { | 496 OtherOriginCORSCredentials) { |
| 497 EXPECT_EQ(GetRequestStringForPNACL(), | 497 EXPECT_EQ(GetRequestStringForPNACL(), |
| 498 ExecutePNACLUrlLoaderTest("OtherCORSCredentials")); | 498 ExecutePNACLUrlLoaderTest("OtherCORSCredentials")); |
| 499 } | 499 } |
| 500 | 500 |
| 501 } // namespace | 501 } // namespace |
| OLD | NEW |