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

Side by Side Diff: chrome/browser/extensions/api/alarms/alarms_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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/browsing_data/browsing_data_test.cc » ('j') | 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 // This file tests the chrome.alarms extension API. 5 // This file tests the chrome.alarms extension API.
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "base/test/mock_time_provider.h" 8 #include "base/test/mock_time_provider.h"
9 #include "chrome/browser/extensions/api/alarms/alarm_manager.h" 9 #include "chrome/browser/extensions/api/alarms/alarm_manager.h"
10 #include "chrome/browser/extensions/api/alarms/alarms_api.h" 10 #include "chrome/browser/extensions/api/alarms/alarms_api.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 extension_ = utils::CreateEmptyExtensionWithLocation( 54 extension_ = utils::CreateEmptyExtensionWithLocation(
55 extensions::Extension::LOAD); 55 extensions::Extension::LOAD);
56 56
57 current_time_ = base::Time::FromDoubleT(10); 57 current_time_ = base::Time::FromDoubleT(10);
58 ON_CALL(mock_time_, Now()) 58 ON_CALL(mock_time_, Now())
59 .WillByDefault(testing::ReturnPointee(&current_time_)); 59 .WillByDefault(testing::ReturnPointee(&current_time_));
60 } 60 }
61 61
62 base::Value* RunFunctionWithExtension( 62 base::Value* RunFunctionWithExtension(
63 UIThreadExtensionFunction* function, const std::string& args) { 63 UIThreadExtensionFunction* function, const std::string& args) {
64 scoped_refptr<UIThreadExtensionFunction> delete_function(function);
64 function->set_extension(extension_.get()); 65 function->set_extension(extension_.get());
65 return utils::RunFunctionAndReturnSingleResult(function, args, browser()); 66 return utils::RunFunctionAndReturnSingleResult(function, args, browser());
66 } 67 }
67 68
68 base::DictionaryValue* RunFunctionAndReturnDict( 69 base::DictionaryValue* RunFunctionAndReturnDict(
69 UIThreadExtensionFunction* function, const std::string& args) { 70 UIThreadExtensionFunction* function, const std::string& args) {
70 base::Value* result = RunFunctionWithExtension(function, args); 71 base::Value* result = RunFunctionWithExtension(function, args);
71 return result ? utils::ToDictionary(result) : NULL; 72 return result ? utils::ToDictionary(result) : NULL;
72 } 73 }
73 74
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 EXPECT_TRUE(alarm_manager_->timer_.IsRunning()); 493 EXPECT_TRUE(alarm_manager_->timer_.IsRunning());
493 MessageLoop::current()->Run(); 494 MessageLoop::current()->Run();
494 EXPECT_FALSE(alarm_manager_->timer_.IsRunning()); 495 EXPECT_FALSE(alarm_manager_->timer_.IsRunning());
495 CreateAlarm("[\"bb\", {\"delayInMinutes\": 10}]"); 496 CreateAlarm("[\"bb\", {\"delayInMinutes\": 10}]");
496 EXPECT_TRUE(alarm_manager_->timer_.IsRunning()); 497 EXPECT_TRUE(alarm_manager_->timer_.IsRunning());
497 alarm_manager_->RemoveAllAlarms(extension_->id()); 498 alarm_manager_->RemoveAllAlarms(extension_->id());
498 EXPECT_FALSE(alarm_manager_->timer_.IsRunning()); 499 EXPECT_FALSE(alarm_manager_->timer_.IsRunning());
499 } 500 }
500 501
501 } // namespace extensions 502 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/browsing_data/browsing_data_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698