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

Side by Side Diff: chrome/browser/extensions/api/socket/socket_api_unittest.cc

Issue 10825127: Valgrind: Clean up leaks in callers to extension_function_test_utils::RunFunction. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 (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 #include "base/values.h" 5 #include "base/values.h"
6 #include "chrome/browser/browser_process_impl.h" 6 #include "chrome/browser/browser_process_impl.h"
7 #include "chrome/browser/extensions/api/socket/socket_api.h" 7 #include "chrome/browser/extensions/api/socket/socket_api.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/extensions/test_extension_system.h" 9 #include "chrome/browser/extensions/test_extension_system.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 14 matching lines...) Expand all
25 TestExtensionSystem* system = static_cast<TestExtensionSystem*>( 25 TestExtensionSystem* system = static_cast<TestExtensionSystem*>(
26 ExtensionSystem::Get(browser()->profile())); 26 ExtensionSystem::Get(browser()->profile()));
27 system->CreateSocketManager(); 27 system->CreateSocketManager();
28 28
29 extension_ = utils::CreateEmptyExtensionWithLocation( 29 extension_ = utils::CreateEmptyExtensionWithLocation(
30 extensions::Extension::LOAD); 30 extensions::Extension::LOAD);
31 } 31 }
32 32
33 base::Value* RunFunctionWithExtension( 33 base::Value* RunFunctionWithExtension(
34 UIThreadExtensionFunction* function, const std::string& args) { 34 UIThreadExtensionFunction* function, const std::string& args) {
35 scoped_refptr<UIThreadExtensionFunction> delete_function(function);
35 function->set_extension(extension_.get()); 36 function->set_extension(extension_.get());
36 return utils::RunFunctionAndReturnSingleResult(function, args, browser()); 37 return utils::RunFunctionAndReturnSingleResult(function, args, browser());
37 } 38 }
38 39
39 base::DictionaryValue* RunFunctionAndReturnDict( 40 base::DictionaryValue* RunFunctionAndReturnDict(
40 UIThreadExtensionFunction* function, const std::string& args) { 41 UIThreadExtensionFunction* function, const std::string& args) {
41 base::Value* result = RunFunctionWithExtension(function, args); 42 base::Value* result = RunFunctionWithExtension(function, args);
42 return result ? utils::ToDictionary(result) : NULL; 43 return result ? utils::ToDictionary(result) : NULL;
43 } 44 }
44 45
(...skipping 29 matching lines...) Expand all
74 ASSERT_TRUE(result.get()); 75 ASSERT_TRUE(result.get());
75 } 76 }
76 { 77 {
77 std::string error = RunFunctionAndReturnError( 78 std::string error = RunFunctionAndReturnError(
78 new SocketCreateFunction(), "[\"nonexistent-socket-type\"]"); 79 new SocketCreateFunction(), "[\"nonexistent-socket-type\"]");
79 ASSERT_FALSE(error.empty()) << "Expected error. Got nothing instead."; 80 ASSERT_FALSE(error.empty()) << "Expected error. Got nothing instead.";
80 } 81 }
81 } 82 }
82 83
83 } // namespace extensions 84 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api_unittest.cc ('k') | chrome/browser/extensions/api/tabs/tabs_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698