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 "chrome/browser/extensions/extension_api_unittest.h" | 5 #include "chrome/browser/extensions/extension_api_unittest.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/extensions/extension_function_test_utils.h" | 8 #include "chrome/browser/extensions/extension_function_test_utils.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 void ExtensionApiUnittest::SetUp() { | 28 void ExtensionApiUnittest::SetUp() { |
29 BrowserWithTestWindowTest::SetUp(); | 29 BrowserWithTestWindowTest::SetUp(); |
30 extension_ = utils::CreateEmptyExtensionWithLocation(Manifest::UNPACKED); | 30 extension_ = utils::CreateEmptyExtensionWithLocation(Manifest::UNPACKED); |
31 } | 31 } |
32 | 32 |
33 void ExtensionApiUnittest::CreateBackgroundPage() { | 33 void ExtensionApiUnittest::CreateBackgroundPage() { |
34 if (!contents_) { | 34 if (!contents_) { |
35 GURL url = BackgroundInfo::GetBackgroundURL(extension()); | 35 GURL url = BackgroundInfo::GetBackgroundURL(extension()); |
36 if (url.is_empty()) | 36 if (url.is_empty()) |
37 url = GURL(content::kAboutBlankURL); | 37 url = GURL(url::kAboutBlankURL); |
38 AddTab(browser(), url); | 38 AddTab(browser(), url); |
39 contents_ = browser()->tab_strip_model()->GetActiveWebContents(); | 39 contents_ = browser()->tab_strip_model()->GetActiveWebContents(); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 scoped_ptr<base::Value> ExtensionApiUnittest::RunFunctionAndReturnValue( | 43 scoped_ptr<base::Value> ExtensionApiUnittest::RunFunctionAndReturnValue( |
44 UIThreadExtensionFunction* function, const std::string& args) { | 44 UIThreadExtensionFunction* function, const std::string& args) { |
45 function->set_extension(extension()); | 45 function->set_extension(extension()); |
46 if (contents_) | 46 if (contents_) |
47 function->SetRenderViewHost(contents_->GetRenderViewHost()); | 47 function->SetRenderViewHost(contents_->GetRenderViewHost()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 function->SetRenderViewHost(contents_->GetRenderViewHost()); | 85 function->SetRenderViewHost(contents_->GetRenderViewHost()); |
86 return utils::RunFunctionAndReturnError(function, args, browser()); | 86 return utils::RunFunctionAndReturnError(function, args, browser()); |
87 } | 87 } |
88 | 88 |
89 void ExtensionApiUnittest::RunFunction( | 89 void ExtensionApiUnittest::RunFunction( |
90 UIThreadExtensionFunction* function, const std::string& args) { | 90 UIThreadExtensionFunction* function, const std::string& args) { |
91 RunFunctionAndReturnValue(function, args); | 91 RunFunctionAndReturnValue(function, args); |
92 } | 92 } |
93 | 93 |
94 } // namespace extensions | 94 } // namespace extensions |
OLD | NEW |