| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, NotificationAPI) { | 597 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, NotificationAPI) { |
| 598 EXPECT_TRUE(RunExtensionSubtest("service_worker/notifications/has_permission", | 598 EXPECT_TRUE(RunExtensionSubtest("service_worker/notifications/has_permission", |
| 599 "page.html")); | 599 "page.html")); |
| 600 } | 600 } |
| 601 | 601 |
| 602 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, WebAccessibleResourcesFetch) { | 602 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, WebAccessibleResourcesFetch) { |
| 603 EXPECT_TRUE(RunExtensionSubtest( | 603 EXPECT_TRUE(RunExtensionSubtest( |
| 604 "service_worker/web_accessible_resources/fetch/", "page.html")); | 604 "service_worker/web_accessible_resources/fetch/", "page.html")); |
| 605 } | 605 } |
| 606 | 606 |
| 607 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, TabsCreate) { |
| 608 const Extension* extension = LoadExtensionWithFlags( |
| 609 test_data_dir_.AppendASCII("service_worker/tabs_create"), kFlagNone); |
| 610 ASSERT_TRUE(extension); |
| 611 ui_test_utils::NavigateToURL(browser(), |
| 612 extension->GetResourceURL("page.html")); |
| 613 content::WebContents* web_contents = |
| 614 browser()->tab_strip_model()->GetActiveWebContents(); |
| 615 |
| 616 int starting_tab_count = browser()->tab_strip_model()->count(); |
| 617 std::string result; |
| 618 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| 619 web_contents, "window.runServiceWorker()", &result)); |
| 620 EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count()); |
| 621 |
| 622 // Check extension shutdown path. |
| 623 UnloadExtension(extension->id()); |
| 624 EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count()); |
| 625 } |
| 626 |
| 607 // This test loads a web page that has an iframe pointing to a | 627 // This test loads a web page that has an iframe pointing to a |
| 608 // chrome-extension:// URL. The URL is listed in the extension's | 628 // chrome-extension:// URL. The URL is listed in the extension's |
| 609 // web_accessible_resources. Initially the iframe is served from the extension's | 629 // web_accessible_resources. Initially the iframe is served from the extension's |
| 610 // resource file. After verifying that, we register a Service Worker that | 630 // resource file. After verifying that, we register a Service Worker that |
| 611 // controls the extension. Further requests to the same resource as before | 631 // controls the extension. Further requests to the same resource as before |
| 612 // should now be served by the Service Worker. | 632 // should now be served by the Service Worker. |
| 613 // This test also verifies that if the requested resource exists in the manifest | 633 // This test also verifies that if the requested resource exists in the manifest |
| 614 // but is not present in the extension directory, the Service Worker can still | 634 // but is not present in the extension directory, the Service Worker can still |
| 615 // serve the resource file. | 635 // serve the resource file. |
| 616 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, WebAccessibleResourcesIframeSrc) { | 636 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, WebAccessibleResourcesIframeSrc) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 push_message_listener.set_failure_message("FAIL"); | 759 push_message_listener.set_failure_message("FAIL"); |
| 740 gcm::IncomingMessage message; | 760 gcm::IncomingMessage message; |
| 741 message.sender_id = "1234567890"; | 761 message.sender_id = "1234567890"; |
| 742 message.raw_data = "testdata"; | 762 message.raw_data = "testdata"; |
| 743 message.decrypted = true; | 763 message.decrypted = true; |
| 744 push_service()->OnMessage(app_identifier.app_id(), message); | 764 push_service()->OnMessage(app_identifier.app_id(), message); |
| 745 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); | 765 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); |
| 746 } | 766 } |
| 747 | 767 |
| 748 } // namespace extensions | 768 } // namespace extensions |
| OLD | NEW |