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

Side by Side Diff: extensions/browser/api_test_utils.cc

Issue 789643004: Move chrome.alarms API from chrome/ to extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move tests to extensions/. Created 5 years, 11 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
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 "extensions/browser/api_test_utils.h" 5 #include "extensions/browser/api_test_utils.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "components/crx_file/id_util.h" 10 #include "components/crx_file/id_util.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 EXPECT_TRUE(error.empty()) << "Could not parse test extension " << error; 128 EXPECT_TRUE(error.empty()) << "Could not parse test extension " << error;
129 return extension; 129 return extension;
130 } 130 }
131 131
132 scoped_refptr<Extension> CreateExtension( 132 scoped_refptr<Extension> CreateExtension(
133 base::DictionaryValue* test_extension_value) { 133 base::DictionaryValue* test_extension_value) {
134 return CreateExtension(Manifest::INTERNAL, test_extension_value, 134 return CreateExtension(Manifest::INTERNAL, test_extension_value,
135 std::string()); 135 std::string());
136 } 136 }
137 137
138 scoped_refptr<Extension> CreateEmptyExtensionWithLocation(
139 Manifest::Location location) {
140 scoped_ptr<base::DictionaryValue> test_extension_value(
James Cook 2015/01/17 00:51:28 This looks like it is copied from //chrome. Can yo
babu 2015/01/17 11:53:56 Done. Moved this helper function from extension_f
141 extensions::api_test_utils::ParseDictionary(
142 "{\"name\": \"Test\", \"version\": \"1.0\"}"));
143 return extensions::api_test_utils::CreateExtension(
144 location, test_extension_value.get(), std::string());
145 }
146
138 base::Value* RunFunctionWithDelegateAndReturnSingleResult( 147 base::Value* RunFunctionWithDelegateAndReturnSingleResult(
139 UIThreadExtensionFunction* function, 148 UIThreadExtensionFunction* function,
140 const std::string& args, 149 const std::string& args,
141 content::BrowserContext* context, 150 content::BrowserContext* context,
142 scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher) { 151 scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher) {
143 return RunFunctionWithDelegateAndReturnSingleResult( 152 return RunFunctionWithDelegateAndReturnSingleResult(
144 function, args, context, dispatcher.Pass(), NONE); 153 function, args, context, dispatcher.Pass(), NONE);
145 } 154 }
146 155
147 base::Value* RunFunctionWithDelegateAndReturnSingleResult( 156 base::Value* RunFunctionWithDelegateAndReturnSingleResult(
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 response_delegate.set_should_post_quit(true); 257 response_delegate.set_should_post_quit(true);
249 content::RunMessageLoop(); 258 content::RunMessageLoop();
250 } 259 }
251 260
252 EXPECT_TRUE(response_delegate.HasResponse()); 261 EXPECT_TRUE(response_delegate.HasResponse());
253 return response_delegate.GetResponse(); 262 return response_delegate.GetResponse();
254 } 263 }
255 264
256 } // namespace api_test_utils 265 } // namespace api_test_utils
257 } // namespace extensions 266 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698