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

Unified Diff: extensions/browser/api_test_utils.cc

Issue 1968083004: Implement the private API for quick unlock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Migrate browser tests to unit tests Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api_test_utils.cc
diff --git a/extensions/browser/api_test_utils.cc b/extensions/browser/api_test_utils.cc
index 0dafbbe00789b69248ffe745a71cecc8337886e9..57b4a3e33277be4bfcb18dcde23882446b3fac69 100644
--- a/extensions/browser/api_test_utils.cc
+++ b/extensions/browser/api_test_utils.cc
@@ -159,6 +159,26 @@ base::Value* RunFunctionWithDelegateAndReturnSingleResult(
return NULL;
}
+base::Value* RunFunctionWithDelegateAndReturnSingleResult(
Devlin 2016/06/06 16:35:01 If you want to add this, we should do a few things
jdufault 2016/06/08 18:39:10 I've made the other version call into this one. B
Devlin 2016/06/08 23:26:41 The old versions of this *should* return a std::un
Devlin 2016/06/13 14:50:23 Looks like this still needs to be done?
jdufault 2016/06/20 22:18:25 I've changed the APIs. This propagated to a number
+ UIThreadExtensionFunction* function,
+ std::unique_ptr<base::ListValue> args,
+ content::BrowserContext* context,
+ std::unique_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
+ RunFunctionFlags flags) {
+ scoped_refptr<ExtensionFunction> function_owner(function);
+ // Without a callback the function will not generate a result.
+ function->set_has_callback(true);
+ RunFunction(function, std::move(args), context, std::move(dispatcher), flags);
+ EXPECT_TRUE(function->GetError().empty()) << "Unexpected error: "
+ << function->GetError();
+ const base::Value* single_result = NULL;
+ if (function->GetResultList() != NULL &&
+ function->GetResultList()->Get(0, &single_result)) {
+ return single_result->DeepCopy();
+ }
+ return NULL;
+}
+
base::Value* RunFunctionAndReturnSingleResult(
UIThreadExtensionFunction* function,
const std::string& args,

Powered by Google App Engine
This is Rietveld 408576698