Index: chrome/browser/extensions/process_manager_browsertest.cc |
diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc |
index 26355530e1518b72c5f6e917ab4dd61156635581..8386a11031e7675a3137fcc2f1bd46e1049b6f5e 100644 |
--- a/chrome/browser/extensions/process_manager_browsertest.cc |
+++ b/chrome/browser/extensions/process_manager_browsertest.cc |
@@ -37,6 +37,7 @@ |
#include "extensions/browser/app_window/app_window.h" |
#include "extensions/browser/app_window/app_window_registry.h" |
#include "extensions/browser/process_manager.h" |
+#include "extensions/common/manifest_handlers/background_info.h" |
#include "extensions/common/permissions/permissions_data.h" |
#include "extensions/common/value_builder.h" |
#include "extensions/test/background_page_watcher.h" |
@@ -286,6 +287,9 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, |
.AppendASCII("none")); |
ASSERT_TRUE(extension.get()); |
+ EXPECT_TRUE(BackgroundInfo::HasPersistentBackgroundPage(extension.get())); |
+ EXPECT_EQ(-1, pm->GetLazyKeepaliveCount(extension.get())); |
+ |
// Process manager gains a background host. |
EXPECT_EQ(1u, pm->background_hosts().size()); |
EXPECT_EQ(1u, pm->GetAllFrames().size()); |
@@ -293,7 +297,6 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, |
EXPECT_TRUE(pm->GetSiteInstanceForURL(extension->url())); |
EXPECT_EQ(1u, pm->GetRenderFrameHostsForExtension(extension->id()).size()); |
EXPECT_FALSE(pm->IsBackgroundHostClosing(extension->id())); |
- EXPECT_EQ(0, pm->GetLazyKeepaliveCount(extension.get())); |
// Unload the extension. |
UnloadExtension(extension->id()); |
@@ -305,7 +308,6 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, |
EXPECT_TRUE(pm->GetSiteInstanceForURL(extension->url())); |
EXPECT_EQ(0u, pm->GetRenderFrameHostsForExtension(extension->id()).size()); |
EXPECT_FALSE(pm->IsBackgroundHostClosing(extension->id())); |
- EXPECT_EQ(0, pm->GetLazyKeepaliveCount(extension.get())); |
} |
// Test that loading an extension with a browser action does not create a |
@@ -324,6 +326,9 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, |
.AppendASCII("popup")); |
ASSERT_TRUE(popup.get()); |
+ EXPECT_FALSE(BackgroundInfo::HasBackgroundPage(extension.get())); |
+ EXPECT_EQ(-1, pm->GetLazyKeepaliveCount(extension.get())); |
+ |
// No background host was added. |
EXPECT_EQ(0u, pm->background_hosts().size()); |
EXPECT_EQ(0u, pm->GetAllFrames().size()); |
@@ -331,7 +336,6 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, |
EXPECT_EQ(0u, pm->GetRenderFrameHostsForExtension(popup->id()).size()); |
EXPECT_TRUE(pm->GetSiteInstanceForURL(popup->url())); |
EXPECT_FALSE(pm->IsBackgroundHostClosing(popup->id())); |
- EXPECT_EQ(0, pm->GetLazyKeepaliveCount(popup.get())); |
// Simulate clicking on the action to open a popup. |
BrowserActionTestUtil test_util(browser()); |
@@ -350,7 +354,6 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, |
EXPECT_EQ(1u, pm->GetRenderFrameHostsForExtension(popup->id()).size()); |
EXPECT_TRUE(pm->GetSiteInstanceForURL(popup->url())); |
EXPECT_FALSE(pm->IsBackgroundHostClosing(popup->id())); |
- EXPECT_EQ(0, pm->GetLazyKeepaliveCount(popup.get())); |
Devlin
2017/02/14 17:48:37
nitty nit: might be worth keeping this (as a check
Wez
2017/02/14 20:02:22
Done.
|
} |
// Content loaded from http://hlogonemlfkgpejgnedahbkiabcdhnnn should not |
@@ -609,7 +612,9 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, KeepaliveOnNetworkRequest) { |
// Keepalive count at this point is unpredictable as there may be an |
// outstanding event dispatch. We use the current keepalive count as a |
// reliable baseline for future expectations. |
+ EXPECT_TRUE(BackgroundInfo::HasLazyBackgroundPage(extension.get())); |
int baseline_keepalive = pm->GetLazyKeepaliveCount(extension.get()); |
+ EXPECT_LE(0, baseline_keepalive); |
// Simulate some network events. This test assumes no other network requests |
// are pending, i.e., that there are no conflicts with the fake request IDs |