| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/profiles/profile_destroyer.h" | 5 #include "chrome/browser/profiles/profile_destroyer.h" |
| 6 | 6 |
| 7 #include "chrome/test/base/browser_with_test_window_test.h" | 7 #include "chrome/test/base/browser_with_test_window_test.h" |
| 8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
| 9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
| 10 #include "content/public/browser/site_instance.h" | 10 #include "content/public/browser/site_instance.h" |
| 11 | 11 |
| 12 class TestingOffTheRecordDestructionProfile : public TestingProfile { | 12 class TestingOffTheRecordDestructionProfile : public TestingProfile { |
| 13 public: | 13 public: |
| 14 TestingOffTheRecordDestructionProfile() : destroyed_otr_profile_(false) { | 14 TestingOffTheRecordDestructionProfile() |
| 15 : TestingProfile(base::FilePath(), |
| 16 NULL, |
| 17 scoped_refptr<ExtensionSpecialStoragePolicy>() |
| 18 scoped_ptr<PrefServiceSyncable>(), |
| 19 true, |
| 20 TestingFactories()), |
| 21 destroyed_otr_profile_(false) { |
| 15 set_incognito(true); | 22 set_incognito(true); |
| 16 } | 23 } |
| 17 virtual void DestroyOffTheRecordProfile() OVERRIDE { | 24 virtual void DestroyOffTheRecordProfile() OVERRIDE { |
| 18 destroyed_otr_profile_ = true; | 25 destroyed_otr_profile_ = true; |
| 19 } | 26 } |
| 20 bool destroyed_otr_profile_; | 27 bool destroyed_otr_profile_; |
| 21 | 28 |
| 22 DISALLOW_COPY_AND_ASSIGN(TestingOffTheRecordDestructionProfile); | 29 DISALLOW_COPY_AND_ASSIGN(TestingOffTheRecordDestructionProfile); |
| 23 }; | 30 }; |
| 24 | 31 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 scoped_ptr<content::RenderProcessHost> render_process_host2; | 136 scoped_ptr<content::RenderProcessHost> render_process_host2; |
| 130 render_process_host2.reset(instance2->GetProcess()); | 137 render_process_host2.reset(instance2->GetProcess()); |
| 131 ASSERT_TRUE(render_process_host2.get() != NULL); | 138 ASSERT_TRUE(render_process_host2.get() != NULL); |
| 132 | 139 |
| 133 ProfileDestroyer::DestroyProfileWhenAppropriate(main_profile); | 140 ProfileDestroyer::DestroyProfileWhenAppropriate(main_profile); |
| 134 EXPECT_EQ(main_profile, TestingOriginalDestructionProfile::living_instance_); | 141 EXPECT_EQ(main_profile, TestingOriginalDestructionProfile::living_instance_); |
| 135 render_process_host2.release()->Cleanup(); | 142 render_process_host2.release()->Cleanup(); |
| 136 base::MessageLoop::current()->RunUntilIdle(); | 143 base::MessageLoop::current()->RunUntilIdle(); |
| 137 EXPECT_EQ(NULL, TestingOriginalDestructionProfile::living_instance_); | 144 EXPECT_EQ(NULL, TestingOriginalDestructionProfile::living_instance_); |
| 138 } | 145 } |
| OLD | NEW |