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

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: address comments from falken@ Created 4 years, 2 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ASSERT_EQ("chrome.tabs.update callback", result);
Devlin 2016/10/05 17:02:25 I'm a little confused on the test for this. Where
lazyboy 2016/10/06 01:02:06 We don't. I only tested them with hacking the time
Devlin 2016/10/06 16:35:12 Can we add an explicit TODO? And out of curiosity
lazyboy 2016/10/06 17:57:37 Done. And out of curiosity, what are the main
Devlin 2016/10/06 18:58:06 Can we access the refcount from chrome/ (or could
lazyboy 2016/10/07 06:00:57 Added a test only method in content/public, added
626 EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count()); 626 EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count());
627 627
628 // Check extension shutdown path. 628 // Check extension shutdown path.
629 UnloadExtension(extension->id()); 629 UnloadExtension(extension->id());
630 EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count()); 630 EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
631 } 631 }
632 632
633 // This test loads a web page that has an iframe pointing to a 633 // 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 634 // chrome-extension:// URL. The URL is listed in the extension's
635 // web_accessible_resources. Initially the iframe is served from the extension's 635 // web_accessible_resources. Initially the iframe is served from the extension's
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 message.sender_id = "1234567890"; 783 message.sender_id = "1234567890";
784 message.raw_data = "testdata"; 784 message.raw_data = "testdata";
785 message.decrypted = true; 785 message.decrypted = true;
786 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure()); 786 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure());
787 push_service()->OnMessage(app_identifier.app_id(), message); 787 push_service()->OnMessage(app_identifier.app_id(), message);
788 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); 788 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied());
789 run_loop.Run(); // Wait until the message is handled by push service. 789 run_loop.Run(); // Wait until the message is handled by push service.
790 } 790 }
791 791
792 } // namespace extensions 792 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698