| 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 // This file tests the chrome.alarms extension API. | 5 // This file tests the chrome.alarms extension API. |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browser_process_impl.h" | 9 #include "chrome/browser/browser_process_impl.h" |
| 10 #include "chrome/browser/extensions/api/discovery/discovery_api.h" | 10 #include "chrome/browser/extensions/api/discovery/discovery_api.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 public: | 73 public: |
| 74 virtual void SetUp() { | 74 virtual void SetUp() { |
| 75 BrowserWithTestWindowTest::SetUp(); | 75 BrowserWithTestWindowTest::SetUp(); |
| 76 extension_ = utils::CreateEmptyExtensionWithLocation(Extension::LOAD); | 76 extension_ = utils::CreateEmptyExtensionWithLocation(Extension::LOAD); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // Runs a function and returns a pointer to a value, transferring ownership. | 79 // Runs a function and returns a pointer to a value, transferring ownership. |
| 80 base::Value* RunFunctionWithExtension( | 80 base::Value* RunFunctionWithExtension( |
| 81 UIThreadExtensionFunction* function, const std::string& args) { | 81 UIThreadExtensionFunction* function, const std::string& args) { |
| 82 function->set_extension(extension_.get()); | 82 function->set_extension(extension_.get()); |
| 83 return utils::RunFunctionAndReturnResult(function, args, browser()); | 83 return utils::RunFunctionAndReturnSingleResult(function, args, browser()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Runs a function and ignores the return value. | 86 // Runs a function and ignores the return value. |
| 87 void RunFunction(UIThreadExtensionFunction* function, | 87 void RunFunction(UIThreadExtensionFunction* function, |
| 88 const std::string& args) { | 88 const std::string& args) { |
| 89 scoped_ptr<base::Value> result(RunFunctionWithExtension(function, args)); | 89 scoped_ptr<base::Value> result(RunFunctionWithExtension(function, args)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Runs a function without argumentsand ignores the return value. | 92 // Runs a function without argumentsand ignores the return value. |
| 93 void RunFunctionWithoutArguments(UIThreadExtensionFunction* function, | 93 void RunFunctionWithoutArguments(UIThreadExtensionFunction* function, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 extensions::SuggestedLinksRegistry* registry = | 197 extensions::SuggestedLinksRegistry* registry = |
| 198 extensions::SuggestedLinksRegistryFactory::GetForProfile( | 198 extensions::SuggestedLinksRegistryFactory::GetForProfile( |
| 199 browser()->profile()); | 199 browser()->profile()); |
| 200 | 200 |
| 201 const SuggestedLinkList* links = registry->GetAll(GetExtensionId()); | 201 const SuggestedLinkList* links = registry->GetAll(GetExtensionId()); |
| 202 ASSERT_EQ(0u, links->size()); | 202 ASSERT_EQ(0u, links->size()); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace extensions | 205 } // namespace extensions |
| OLD | NEW |