Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: chrome/browser/extensions/service_worker_apitest.cc

Issue 2166523003: Add ref count to service workers for extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 ASSERT_TRUE(extension); 605 ASSERT_TRUE(extension);
606 ui_test_utils::NavigateToURL(browser(), 606 ui_test_utils::NavigateToURL(browser(),
607 extension->GetResourceURL("page.html")); 607 extension->GetResourceURL("page.html"));
608 content::WebContents* web_contents = 608 content::WebContents* web_contents =
609 browser()->tab_strip_model()->GetActiveWebContents(); 609 browser()->tab_strip_model()->GetActiveWebContents();
610 610
611 int starting_tab_count = browser()->tab_strip_model()->count(); 611 int starting_tab_count = browser()->tab_strip_model()->count();
612 std::string result; 612 std::string result;
613 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 613 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
614 web_contents, "window.runServiceWorker()", &result)); 614 web_contents, "window.runServiceWorker()", &result));
615 ASSERT_EQ("chrome.tabs.create callback", result); 615 ASSERT_EQ("chrome.tabs.update callback", result);
616 EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count()); 616 EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count());
617 617
618 // Check extension shutdown path. 618 // Check extension shutdown path.
619 UnloadExtension(extension->id()); 619 UnloadExtension(extension->id());
620 EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count()); 620 EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
621 } 621 }
622 622
623 // This test loads a web page that has an iframe pointing to a 623 // This test loads a web page that has an iframe pointing to a
624 // chrome-extension:// URL. The URL is listed in the extension's 624 // chrome-extension:// URL. The URL is listed in the extension's
625 // web_accessible_resources. Initially the iframe is served from the extension's 625 // web_accessible_resources. Initially the iframe is served from the extension's
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 message.sender_id = "1234567890"; 773 message.sender_id = "1234567890";
774 message.raw_data = "testdata"; 774 message.raw_data = "testdata";
775 message.decrypted = true; 775 message.decrypted = true;
776 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure()); 776 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure());
777 push_service()->OnMessage(app_identifier.app_id(), message); 777 push_service()->OnMessage(app_identifier.app_id(), message);
778 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); 778 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied());
779 run_loop.Run(); // Wait until the message is handled by push service. 779 run_loop.Run(); // Wait until the message is handled by push service.
780 } 780 }
781 781
782 } // namespace extensions 782 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698