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/extensions/test_extension_environment.h" | 5 #include "chrome/browser/extensions/test_extension_environment.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 extension_service_(NULL) { | 31 extension_service_(NULL) { |
32 file_thread_.Start(); | 32 file_thread_.Start(); |
33 file_blocking_thread_.Start(); | 33 file_blocking_thread_.Start(); |
34 io_thread_.StartIOThread(); | 34 io_thread_.StartIOThread(); |
35 } | 35 } |
36 | 36 |
37 TestExtensionEnvironment::~TestExtensionEnvironment() { | 37 TestExtensionEnvironment::~TestExtensionEnvironment() { |
38 profile_.reset(); | 38 profile_.reset(); |
39 // Delete the profile, and then cycle the message loop to clear | 39 // Delete the profile, and then cycle the message loop to clear |
40 // out delayed deletions. | 40 // out delayed deletions. |
41 base::RunLoop run_loop; | 41 base::RunLoop().RunUntilIdle(); |
42 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); | |
43 run_loop.Run(); | |
44 } | 42 } |
45 | 43 |
46 TestingProfile* TestExtensionEnvironment::profile() const { | 44 TestingProfile* TestExtensionEnvironment::profile() const { |
47 return profile_.get(); | 45 return profile_.get(); |
48 } | 46 } |
49 | 47 |
50 ExtensionService* TestExtensionEnvironment::GetExtensionService() { | 48 ExtensionService* TestExtensionEnvironment::GetExtensionService() { |
51 if (extension_service_ == NULL) { | 49 if (extension_service_ == NULL) { |
52 TestExtensionSystem* extension_system = | 50 TestExtensionSystem* extension_system = |
53 static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile())); | 51 static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile())); |
(...skipping 27 matching lines...) Expand all Loading... |
81 | 79 |
82 scoped_ptr<content::WebContents> TestExtensionEnvironment::MakeTab() const { | 80 scoped_ptr<content::WebContents> TestExtensionEnvironment::MakeTab() const { |
83 scoped_ptr<content::WebContents> contents( | 81 scoped_ptr<content::WebContents> contents( |
84 content::WebContentsTester::CreateTestWebContents(profile(), NULL)); | 82 content::WebContentsTester::CreateTestWebContents(profile(), NULL)); |
85 // Create a tab id. | 83 // Create a tab id. |
86 SessionTabHelper::CreateForWebContents(contents.get()); | 84 SessionTabHelper::CreateForWebContents(contents.get()); |
87 return contents.Pass(); | 85 return contents.Pass(); |
88 } | 86 } |
89 | 87 |
90 } // namespace extensions | 88 } // namespace extensions |
OLD | NEW |