Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: chrome/browser/extensions/extension_api_unittest.cc

Issue 292713003: Session restore shouldn't care about profile home pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable 2 tests on mac (they fail after "fixed") Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "content/public/common/url_constants.h"
12 #include "extensions/browser/extension_function.h" 13 #include "extensions/browser/extension_function.h"
13 #include "extensions/common/extension.h" 14 #include "extensions/common/extension.h"
14 #include "extensions/common/manifest.h" 15 #include "extensions/common/manifest.h"
15 #include "extensions/common/manifest_handlers/background_info.h" 16 #include "extensions/common/manifest_handlers/background_info.h"
16 17
17 namespace utils = extension_function_test_utils; 18 namespace utils = extension_function_test_utils;
18 19
19 namespace extensions { 20 namespace extensions {
20 21
21 ExtensionApiUnittest::ExtensionApiUnittest() : contents_(NULL) { 22 ExtensionApiUnittest::ExtensionApiUnittest() : contents_(NULL) {
22 } 23 }
23 24
24 ExtensionApiUnittest::~ExtensionApiUnittest() { 25 ExtensionApiUnittest::~ExtensionApiUnittest() {
25 } 26 }
26 27
27 void ExtensionApiUnittest::SetUp() { 28 void ExtensionApiUnittest::SetUp() {
28 BrowserWithTestWindowTest::SetUp(); 29 BrowserWithTestWindowTest::SetUp();
29 extension_ = utils::CreateEmptyExtensionWithLocation(Manifest::UNPACKED); 30 extension_ = utils::CreateEmptyExtensionWithLocation(Manifest::UNPACKED);
30 } 31 }
31 32
32 void ExtensionApiUnittest::CreateBackgroundPage() { 33 void ExtensionApiUnittest::CreateBackgroundPage() {
33 if (!contents_) { 34 if (!contents_) {
34 AddTab(browser(), BackgroundInfo::GetBackgroundURL(extension())); 35 GURL url = BackgroundInfo::GetBackgroundURL(extension());
36 if (url.is_empty())
37 url = GURL(content::kAboutBlankURL);
38 AddTab(browser(), url);
35 contents_ = browser()->tab_strip_model()->GetActiveWebContents(); 39 contents_ = browser()->tab_strip_model()->GetActiveWebContents();
36 } 40 }
37 } 41 }
38 42
39 scoped_ptr<base::Value> ExtensionApiUnittest::RunFunctionAndReturnValue( 43 scoped_ptr<base::Value> ExtensionApiUnittest::RunFunctionAndReturnValue(
40 UIThreadExtensionFunction* function, const std::string& args) { 44 UIThreadExtensionFunction* function, const std::string& args) {
41 function->set_extension(extension()); 45 function->set_extension(extension());
42 if (contents_) 46 if (contents_)
43 function->SetRenderViewHost(contents_->GetRenderViewHost()); 47 function->SetRenderViewHost(contents_->GetRenderViewHost());
44 return scoped_ptr<base::Value>( 48 return scoped_ptr<base::Value>(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 function->SetRenderViewHost(contents_->GetRenderViewHost()); 85 function->SetRenderViewHost(contents_->GetRenderViewHost());
82 return utils::RunFunctionAndReturnError(function, args, browser()); 86 return utils::RunFunctionAndReturnError(function, args, browser());
83 } 87 }
84 88
85 void ExtensionApiUnittest::RunFunction( 89 void ExtensionApiUnittest::RunFunction(
86 UIThreadExtensionFunction* function, const std::string& args) { 90 UIThreadExtensionFunction* function, const std::string& args) {
87 RunFunctionAndReturnValue(function, args); 91 RunFunctionAndReturnValue(function, args);
88 } 92 }
89 93
90 } // namespace extensions 94 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_test.cc ('k') | chrome/browser/extensions/extension_tab_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698