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

Side by Side Diff: chrome/browser/extensions/platform_app_browsertest_util.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
« no previous file with comments | « chrome/browser/extensions/extension_management_api_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/extensions/platform_app_browsertest_util.h" 5 #include "chrome/browser/extensions/platform_app_browsertest_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "chrome/browser/extensions/api/tabs/tabs.h" 9 #include "chrome/browser/extensions/api/tabs/tabs.h"
10 #include "chrome/browser/extensions/extension_function_test_utils.h" 10 #include "chrome/browser/extensions/extension_function_test_utils.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 app_registry->shell_windows(); 54 app_registry->shell_windows();
55 for (iter = shell_windows.begin(); iter != shell_windows.end(); ++iter) { 55 for (iter = shell_windows.begin(); iter != shell_windows.end(); ++iter) {
56 return (*iter)->web_contents(); 56 return (*iter)->web_contents();
57 } 57 }
58 58
59 return NULL; 59 return NULL;
60 } 60 }
61 61
62 size_t PlatformAppBrowserTest::RunGetWindowsFunctionForExtension( 62 size_t PlatformAppBrowserTest::RunGetWindowsFunctionForExtension(
63 const Extension* extension) { 63 const Extension* extension) {
64 GetAllWindowsFunction* function = new GetAllWindowsFunction(); 64 scoped_refptr<GetAllWindowsFunction> function = new GetAllWindowsFunction();
65 function->set_extension(extension); 65 function->set_extension(extension);
66 scoped_ptr<base::ListValue> result(utils::ToList( 66 scoped_ptr<base::ListValue> result(utils::ToList(
67 utils::RunFunctionAndReturnSingleResult(function, "[]", browser()))); 67 utils::RunFunctionAndReturnSingleResult(function.get(),
68 "[]",
69 browser())));
68 return result->GetSize(); 70 return result->GetSize();
69 } 71 }
70 72
71 bool PlatformAppBrowserTest::RunGetWindowFunctionForExtension( 73 bool PlatformAppBrowserTest::RunGetWindowFunctionForExtension(
72 int window_id, 74 int window_id,
73 const Extension* extension) { 75 const Extension* extension) {
74 GetWindowFunction* function = new GetWindowFunction(); 76 scoped_refptr<GetWindowFunction> function = new GetWindowFunction();
75 function->set_extension(extension); 77 function->set_extension(extension);
76 utils::RunFunction( 78 utils::RunFunction(
77 function, 79 function.get(),
78 base::StringPrintf("[%u]", window_id), 80 base::StringPrintf("[%u]", window_id),
79 browser(), 81 browser(),
80 utils::NONE); 82 utils::NONE);
81 return function->GetResultList() != NULL; 83 return function->GetResultList() != NULL;
82 } 84 }
83 85
84 size_t PlatformAppBrowserTest::GetShellWindowCount() { 86 size_t PlatformAppBrowserTest::GetShellWindowCount() {
85 return ShellWindowRegistry::Get(browser()->profile())-> 87 return ShellWindowRegistry::Get(browser()->profile())->
86 shell_windows().size(); 88 shell_windows().size();
87 } 89 }
(...skipping 22 matching lines...) Expand all
110 browser()->profile(), extension, GURL(""), params); 112 browser()->profile(), extension, GURL(""), params);
111 } 113 }
112 114
113 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { 115 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) {
114 content::WindowedNotificationObserver destroyed_observer( 116 content::WindowedNotificationObserver destroyed_observer(
115 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 117 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
116 content::NotificationService::AllSources()); 118 content::NotificationService::AllSources());
117 window->Close(); 119 window->Close();
118 destroyed_observer.Wait(); 120 destroyed_observer.Wait();
119 } 121 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_api_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698