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

Unified Diff: chrome/browser/extensions/api/alarms/alarms_api_unittest.cc

Issue 205323002: Chrome Alarm Clear and ClearAll Updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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: chrome/browser/extensions/api/alarms/alarms_api_unittest.cc
diff --git a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc
index 69da965806c289f102258de4644e2077bd1cb395..0fe501f344ea8ad0b6787adf389fc748e0991c6e 100644
--- a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc
+++ b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc
@@ -389,17 +389,31 @@ void ExtensionAlarmsTestClearGetAllAlarms1Callback(
TEST_F(ExtensionAlarmsTest, Clear) {
// Clear a non-existent one.
{
- std::string error = RunFunctionAndReturnError(
- new AlarmsClearFunction(), "[\"nobody\"]");
- EXPECT_FALSE(error.empty());
+ scoped_ptr<base::Value> result(
+ RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"nobody\"]"));
+ bool copy_bool_result = false;
+ ASSERT_TRUE(result->GetAsBoolean(&copy_bool_result));
+ EXPECT_FALSE(copy_bool_result);
}
// Create 3 alarms.
CreateAlarms(3);
// Clear all but the 0.001-minute alarm.
- RunFunction(new AlarmsClearFunction(), "[\"7\"]");
- RunFunction(new AlarmsClearFunction(), "[\"0\"]");
+ {
+ scoped_ptr<base::Value> result(
+ RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"7\"]"));
+ bool copy_bool_result = false;
+ ASSERT_TRUE(result->GetAsBoolean(&copy_bool_result));
+ EXPECT_TRUE(copy_bool_result);
+ }
+ {
+ scoped_ptr<base::Value> result(
+ RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"0\"]"));
+ bool copy_bool_result = false;
+ ASSERT_TRUE(result->GetAsBoolean(&copy_bool_result));
+ EXPECT_TRUE(copy_bool_result);
+ }
alarm_manager_->GetAllAlarms(extension()->id(), base::Bind(
ExtensionAlarmsTestClearGetAllAlarms1Callback, this));
@@ -427,7 +441,9 @@ TEST_F(ExtensionAlarmsTest, ClearAll) {
{
scoped_ptr<base::Value> result(RunFunctionAndReturnValue(
new AlarmsClearAllFunction(), "[]"));
- EXPECT_FALSE(result.get());
+ bool copy_bool_result = false;
+ ASSERT_TRUE(result->GetAsBoolean(&copy_bool_result));
+ EXPECT_TRUE(copy_bool_result);
}
// Create 3 alarms.

Powered by Google App Engine
This is Rietveld 408576698