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

Unified Diff: chrome/browser/ui/browser_unittest.cc

Issue 9420036: Also delay regular profile destruction... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Merge Goof fix... Created 8 years, 7 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/test/base/browser_with_test_window_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_unittest.cc
diff --git a/chrome/browser/ui/browser_unittest.cc b/chrome/browser/ui/browser_unittest.cc
index f761bdca4fdd863299cf62f51bb0a5a15fa4d76e..7693ccdf43947d1d1013cd0b2ff94ef616c230f3 100644
--- a/chrome/browser/ui/browser_unittest.cc
+++ b/chrome/browser/ui/browser_unittest.cc
@@ -5,36 +5,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/browser_with_test_window_test.h"
-#include "content/public/browser/render_process_host.h"
-#include "content/public/browser/site_instance.h"
-
-class TestingOffTheRecordDestructionProfile : public TestingProfile {
- public:
- TestingOffTheRecordDestructionProfile() : destroyed_profile_(false) {
- set_incognito(true);
- }
- virtual void DestroyOffTheRecordProfile() OVERRIDE {
- destroyed_profile_ = true;
- }
- bool destroyed_profile_;
-
- DISALLOW_COPY_AND_ASSIGN(TestingOffTheRecordDestructionProfile);
-};
-
-class BrowserTestOffTheRecord : public BrowserWithTestWindowTest {
- public:
- BrowserTestOffTheRecord() : off_the_record_profile_(NULL) {}
-
- protected:
- virtual TestingProfile* CreateProfile() OVERRIDE {
- if (off_the_record_profile_ == NULL)
- off_the_record_profile_ = new TestingOffTheRecordDestructionProfile();
- return off_the_record_profile_;
- }
- TestingOffTheRecordDestructionProfile* off_the_record_profile_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowserTestOffTheRecord);
-};
// Various assertions around setting show state.
TEST_F(BrowserWithTestWindowTest, GetSavedWindowShowState) {
@@ -51,35 +21,3 @@ TEST_F(BrowserWithTestWindowTest, GetSavedWindowShowState) {
browser()->set_show_state(ui::SHOW_STATE_FULLSCREEN);
EXPECT_EQ(ui::SHOW_STATE_FULLSCREEN, browser()->GetSavedWindowShowState());
}
-
-TEST_F(BrowserTestOffTheRecord, DelayProfileDestruction) {
- scoped_refptr<content::SiteInstance> instance1(
- static_cast<content::SiteInstance*>(
- content::SiteInstance::Create(off_the_record_profile_)));
- scoped_ptr<content::RenderProcessHost> render_process_host1;
- render_process_host1.reset(instance1->GetProcess());
- ASSERT_TRUE(render_process_host1.get() != NULL);
-
- scoped_refptr<content::SiteInstance> instance2(
- static_cast<content::SiteInstance*>(
- content::SiteInstance::Create(off_the_record_profile_)));
- scoped_ptr<content::RenderProcessHost> render_process_host2;
- render_process_host2.reset(instance2->GetProcess());
- ASSERT_TRUE(render_process_host2.get() != NULL);
-
- // destroying the browser should not destroy the off the record profile...
- set_browser(NULL);
- EXPECT_FALSE(off_the_record_profile_->destroyed_profile_);
-
- // until we destroy the render process host holding on to it...
- render_process_host1.release()->Cleanup();
-
- // And asynchronicity kicked in properly.
- MessageLoop::current()->RunAllPending();
- EXPECT_FALSE(off_the_record_profile_->destroyed_profile_);
-
- // I meant, ALL the render process hosts... :-)
- render_process_host2.release()->Cleanup();
- MessageLoop::current()->RunAllPending();
- EXPECT_TRUE(off_the_record_profile_->destroyed_profile_);
-}
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/test/base/browser_with_test_window_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698