| 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 ASSERT_TRUE(extension); | 615 ASSERT_TRUE(extension); |
| 616 ui_test_utils::NavigateToURL(browser(), | 616 ui_test_utils::NavigateToURL(browser(), |
| 617 extension->GetResourceURL("page.html")); | 617 extension->GetResourceURL("page.html")); |
| 618 content::WebContents* web_contents = | 618 content::WebContents* web_contents = |
| 619 browser()->tab_strip_model()->GetActiveWebContents(); | 619 browser()->tab_strip_model()->GetActiveWebContents(); |
| 620 | 620 |
| 621 int starting_tab_count = browser()->tab_strip_model()->count(); | 621 int starting_tab_count = browser()->tab_strip_model()->count(); |
| 622 std::string result; | 622 std::string result; |
| 623 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 623 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| 624 web_contents, "window.runServiceWorker()", &result)); | 624 web_contents, "window.runServiceWorker()", &result)); |
| 625 ASSERT_EQ("chrome.tabs.create callback", result); | 625 // TODO(lazyboy): Test that after we issue the extension API call, the worker |
| 626 // doesn't terminate until the API returns, even if the API returns after the |
| 627 // worker's timeout expires. The extension API is supposed to add ref count |
| 628 // to the worker and keep it running. |
| 629 ASSERT_EQ("chrome.tabs.update callback", result); |
| 626 EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count()); | 630 EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count()); |
| 627 | 631 |
| 628 // Check extension shutdown path. | 632 // Check extension shutdown path. |
| 629 UnloadExtension(extension->id()); | 633 UnloadExtension(extension->id()); |
| 630 EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count()); | 634 EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count()); |
| 631 } | 635 } |
| 632 | 636 |
| 633 // This test loads a web page that has an iframe pointing to a | 637 // This test loads a web page that has an iframe pointing to a |
| 634 // chrome-extension:// URL. The URL is listed in the extension's | 638 // chrome-extension:// URL. The URL is listed in the extension's |
| 635 // web_accessible_resources. Initially the iframe is served from the extension's | 639 // web_accessible_resources. Initially the iframe is served from the extension's |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 message.sender_id = "1234567890"; | 787 message.sender_id = "1234567890"; |
| 784 message.raw_data = "testdata"; | 788 message.raw_data = "testdata"; |
| 785 message.decrypted = true; | 789 message.decrypted = true; |
| 786 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure()); | 790 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure()); |
| 787 push_service()->OnMessage(app_identifier.app_id(), message); | 791 push_service()->OnMessage(app_identifier.app_id(), message); |
| 788 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); | 792 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); |
| 789 run_loop.Run(); // Wait until the message is handled by push service. | 793 run_loop.Run(); // Wait until the message is handled by push service. |
| 790 } | 794 } |
| 791 | 795 |
| 792 } // namespace extensions | 796 } // namespace extensions |
| OLD | NEW |