| 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 "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "chrome/test/base/browser_with_test_window_test.h" | 9 #include "chrome/test/base/browser_with_test_window_test.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| 11 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
| 12 #include "content/public/browser/site_instance.h" | 12 #include "content/public/browser/site_instance.h" |
| 13 | 13 |
| 14 class TestingOffTheRecordDestructionProfile : public TestingProfile { | 14 class TestingOffTheRecordDestructionProfile : public TestingProfile { |
| 15 public: | 15 public: |
| 16 TestingOffTheRecordDestructionProfile() | 16 TestingOffTheRecordDestructionProfile() |
| 17 : TestingProfile( | 17 : TestingProfile( |
| 18 base::FilePath(), | 18 base::FilePath(), |
| 19 NULL, | 19 NULL, |
| 20 scoped_refptr<ExtensionSpecialStoragePolicy>() | 20 scoped_refptr<ExtensionSpecialStoragePolicy>() |
| 21 std::unique_ptr<syncable_prefs::PrefServiceSyncable>(), | 21 std::unique_ptr<sync_preferences::PrefServiceSyncable>(), |
| 22 true, | 22 true, |
| 23 TestingFactories()), | 23 TestingFactories()), |
| 24 destroyed_otr_profile_(false) { | 24 destroyed_otr_profile_(false) { |
| 25 set_incognito(true); | 25 set_incognito(true); |
| 26 } | 26 } |
| 27 void DestroyOffTheRecordProfile() override { | 27 void DestroyOffTheRecordProfile() override { |
| 28 destroyed_otr_profile_ = true; | 28 destroyed_otr_profile_ = true; |
| 29 } | 29 } |
| 30 bool destroyed_otr_profile_; | 30 bool destroyed_otr_profile_; |
| 31 | 31 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 std::unique_ptr<content::RenderProcessHost> render_process_host2; | 139 std::unique_ptr<content::RenderProcessHost> render_process_host2; |
| 140 render_process_host2.reset(instance2->GetProcess()); | 140 render_process_host2.reset(instance2->GetProcess()); |
| 141 ASSERT_TRUE(render_process_host2.get() != NULL); | 141 ASSERT_TRUE(render_process_host2.get() != NULL); |
| 142 | 142 |
| 143 ProfileDestroyer::DestroyProfileWhenAppropriate(main_profile); | 143 ProfileDestroyer::DestroyProfileWhenAppropriate(main_profile); |
| 144 EXPECT_EQ(main_profile, TestingOriginalDestructionProfile::living_instance_); | 144 EXPECT_EQ(main_profile, TestingOriginalDestructionProfile::living_instance_); |
| 145 render_process_host2.release()->Cleanup(); | 145 render_process_host2.release()->Cleanup(); |
| 146 base::RunLoop().RunUntilIdle(); | 146 base::RunLoop().RunUntilIdle(); |
| 147 EXPECT_EQ(NULL, TestingOriginalDestructionProfile::living_instance_); | 147 EXPECT_EQ(NULL, TestingOriginalDestructionProfile::living_instance_); |
| 148 } | 148 } |
| OLD | NEW |