OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api_unittest.h" | 5 #include "extensions/browser/api_unittest.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "components/user_prefs/user_prefs.h" | 8 #include "components/user_prefs/user_prefs.h" |
9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 extension_ = ExtensionBuilder() | 47 extension_ = ExtensionBuilder() |
48 .SetManifest(DictionaryBuilder() | 48 .SetManifest(DictionaryBuilder() |
49 .Set("name", "Test") | 49 .Set("name", "Test") |
50 .Set("version", "1.0") | 50 .Set("version", "1.0") |
51 .Build()) | 51 .Build()) |
52 .SetLocation(Manifest::UNPACKED) | 52 .SetLocation(Manifest::UNPACKED) |
53 .Build(); | 53 .Build(); |
54 } | 54 } |
55 | 55 |
56 void ApiUnitTest::TearDown() { | |
57 extension_ = nullptr; | |
58 contents_.reset(); | |
59 ExtensionsTest::TearDown(); | |
60 } | |
61 | |
62 void ApiUnitTest::CreateBackgroundPage() { | 56 void ApiUnitTest::CreateBackgroundPage() { |
63 if (!contents_) { | 57 if (!contents_) { |
64 GURL url = BackgroundInfo::GetBackgroundURL(extension()); | 58 GURL url = BackgroundInfo::GetBackgroundURL(extension()); |
65 if (url.is_empty()) | 59 if (url.is_empty()) |
66 url = GURL(url::kAboutBlankURL); | 60 url = GURL(url::kAboutBlankURL); |
67 contents_.reset( | 61 contents_.reset( |
68 content::WebContents::Create(content::WebContents::CreateParams( | 62 content::WebContents::Create(content::WebContents::CreateParams( |
69 browser_context(), | 63 browser_context(), |
70 content::SiteInstance::CreateForURL(browser_context(), url)))); | 64 content::SiteInstance::CreateForURL(browser_context(), url)))); |
71 } | 65 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 function->SetRenderFrameHost(contents_->GetMainFrame()); | 113 function->SetRenderFrameHost(contents_->GetMainFrame()); |
120 return utils::RunFunctionAndReturnError(function, args, browser_context()); | 114 return utils::RunFunctionAndReturnError(function, args, browser_context()); |
121 } | 115 } |
122 | 116 |
123 void ApiUnitTest::RunFunction(UIThreadExtensionFunction* function, | 117 void ApiUnitTest::RunFunction(UIThreadExtensionFunction* function, |
124 const std::string& args) { | 118 const std::string& args) { |
125 RunFunctionAndReturnValue(function, args); | 119 RunFunctionAndReturnValue(function, args); |
126 } | 120 } |
127 | 121 |
128 } // namespace extensions | 122 } // namespace extensions |
OLD | NEW |