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

Unified Diff: chrome/browser/lifetime/keep_alive_registry_unittest.cc

Issue 1803143002: Replace BrowserProces::AddRefModule/RemoveModule by ScopedKeepAlive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/lifetime/keep_alive_registry_unittest.cc
diff --git a/chrome/browser/lifetime/keep_alive_registry_unittest.cc b/chrome/browser/lifetime/keep_alive_registry_unittest.cc
index f6a570404f97583236bade1bf4cdfa8473bfa6ea..8c468f43424d8b576ee2c83860c92a3709871aab 100644
--- a/chrome/browser/lifetime/keep_alive_registry_unittest.cc
+++ b/chrome/browser/lifetime/keep_alive_registry_unittest.cc
@@ -47,8 +47,7 @@ class KeepAliveRegistryTest : public testing::Test,
// a KeepAlive registered.
TEST_F(KeepAliveRegistryTest, BasicKeepAliveTest) {
TestingBrowserProcess* browser_process = TestingBrowserProcess::GetGlobal();
- const unsigned int base_module_ref_count =
- browser_process->module_ref_count();
+ EXPECT_FALSE(browser_process->is_pinned());
KeepAliveRegistry* registry = KeepAliveRegistry::GetInstance();
EXPECT_FALSE(registry->IsKeepingAlive());
@@ -59,12 +58,12 @@ TEST_F(KeepAliveRegistryTest, BasicKeepAliveTest) {
KeepAliveRestartOption::DISABLED);
// We should require the browser to stay alive
- EXPECT_EQ(base_module_ref_count + 1, browser_process->module_ref_count());
+ EXPECT_TRUE(browser_process->is_pinned());
EXPECT_TRUE(registry_->IsKeepingAlive());
}
// We should be back to normal now.
- EXPECT_EQ(base_module_ref_count, browser_process->module_ref_count());
+ EXPECT_FALSE(browser_process->is_pinned());
EXPECT_FALSE(registry_->IsKeepingAlive());
}
@@ -72,28 +71,27 @@ TEST_F(KeepAliveRegistryTest, BasicKeepAliveTest) {
// more than one KeepAlive registered.
TEST_F(KeepAliveRegistryTest, DoubleKeepAliveTest) {
TestingBrowserProcess* browser_process = TestingBrowserProcess::GetGlobal();
- const unsigned int base_module_ref_count =
- browser_process->module_ref_count();
+ EXPECT_FALSE(browser_process->is_pinned());
scoped_ptr<ScopedKeepAlive> keep_alive_1, keep_alive_2;
keep_alive_1.reset(new ScopedKeepAlive(KeepAliveOrigin::CHROME_APP_DELEGATE,
KeepAliveRestartOption::DISABLED));
- EXPECT_EQ(base_module_ref_count + 1, browser_process->module_ref_count());
+ EXPECT_TRUE(browser_process->is_pinned());
EXPECT_TRUE(registry_->IsKeepingAlive());
keep_alive_2.reset(new ScopedKeepAlive(KeepAliveOrigin::CHROME_APP_DELEGATE,
KeepAliveRestartOption::DISABLED));
// We should not increment the count twice
- EXPECT_EQ(base_module_ref_count + 1, browser_process->module_ref_count());
+ EXPECT_TRUE(browser_process->is_pinned());
EXPECT_TRUE(registry_->IsKeepingAlive());
keep_alive_1.reset();
// We should not decrement the count before the last keep alive is released.
- EXPECT_EQ(base_module_ref_count + 1, browser_process->module_ref_count());
+ EXPECT_TRUE(browser_process->is_pinned());
EXPECT_TRUE(registry_->IsKeepingAlive());
keep_alive_2.reset();
- EXPECT_EQ(base_module_ref_count, browser_process->module_ref_count());
+ EXPECT_FALSE(browser_process->is_pinned());
EXPECT_FALSE(registry_->IsKeepingAlive());
}

Powered by Google App Engine
This is Rietveld 408576698