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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return profile_.get(); | 46 return profile_.get(); |
47 } | 47 } |
48 | 48 |
49 TestExtensionSystem* TestExtensionEnvironment::GetExtensionSystem() { | 49 TestExtensionSystem* TestExtensionEnvironment::GetExtensionSystem() { |
50 return static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile())); | 50 return static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile())); |
51 } | 51 } |
52 | 52 |
53 ExtensionService* TestExtensionEnvironment::GetExtensionService() { | 53 ExtensionService* TestExtensionEnvironment::GetExtensionService() { |
54 if (extension_service_ == NULL) { | 54 if (extension_service_ == NULL) { |
55 extension_service_ = GetExtensionSystem()->CreateExtensionService( | 55 extension_service_ = GetExtensionSystem()->CreateExtensionService( |
56 CommandLine::ForCurrentProcess(), base::FilePath(), false); | 56 base::CommandLine::ForCurrentProcess(), base::FilePath(), false); |
57 } | 57 } |
58 return extension_service_; | 58 return extension_service_; |
59 } | 59 } |
60 | 60 |
61 ExtensionPrefs* TestExtensionEnvironment::GetExtensionPrefs() { | 61 ExtensionPrefs* TestExtensionEnvironment::GetExtensionPrefs() { |
62 if (extension_prefs_ == NULL) { | 62 if (extension_prefs_ == NULL) { |
63 extension_prefs_ = GetExtensionSystem()->CreateExtensionPrefs( | 63 extension_prefs_ = GetExtensionSystem()->CreateExtensionPrefs( |
64 CommandLine::ForCurrentProcess(), base::FilePath()); | 64 base::CommandLine::ForCurrentProcess(), base::FilePath()); |
65 } | 65 } |
66 return extension_prefs_; | 66 return extension_prefs_; |
67 } | 67 } |
68 | 68 |
69 const Extension* TestExtensionEnvironment::MakeExtension( | 69 const Extension* TestExtensionEnvironment::MakeExtension( |
70 const base::Value& manifest_extra) { | 70 const base::Value& manifest_extra) { |
71 scoped_ptr<base::DictionaryValue> manifest = DictionaryBuilder() | 71 scoped_ptr<base::DictionaryValue> manifest = DictionaryBuilder() |
72 .Set("name", "Extension") | 72 .Set("name", "Extension") |
73 .Set("version", "1.0") | 73 .Set("version", "1.0") |
74 .Set("manifest_version", 2) | 74 .Set("manifest_version", 2) |
(...skipping 15 matching lines...) Expand all Loading... |
90 | 90 |
91 scoped_ptr<content::WebContents> TestExtensionEnvironment::MakeTab() const { | 91 scoped_ptr<content::WebContents> TestExtensionEnvironment::MakeTab() const { |
92 scoped_ptr<content::WebContents> contents( | 92 scoped_ptr<content::WebContents> contents( |
93 content::WebContentsTester::CreateTestWebContents(profile(), NULL)); | 93 content::WebContentsTester::CreateTestWebContents(profile(), NULL)); |
94 // Create a tab id. | 94 // Create a tab id. |
95 SessionTabHelper::CreateForWebContents(contents.get()); | 95 SessionTabHelper::CreateForWebContents(contents.get()); |
96 return contents.Pass(); | 96 return contents.Pass(); |
97 } | 97 } |
98 | 98 |
99 } // namespace extensions | 99 } // namespace extensions |
OLD | NEW |