提交 3bd9e93d 编写于 作者: N nan-xiansen

【resourceschedule】提醒代理模块用你优化

Signed-off-by: Nnan-xiansen <nanjinbin@huawei.com>
Change-Id: I49b6b2415d4dfd32965c93716553f69266fe5857
上级 56f497b1
......@@ -13,12 +13,13 @@
* limitations under the License.
*/
// @ts-nocheck
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import reminderAgent from '@ohos.reminderAgent'
import notification from '@ohos.notification'
export default function ReminderAgentTest() {
describe('ReminderAgentTest', function () {
describe('ReminderAgentTest', function () {
const TRIGGER_TIME_IN_SECONDS = 100;
......@@ -70,21 +71,19 @@ describe('ReminderAgentTest', function () {
reminderAgent.publishReminder(timer).then((reminderId) => {
console.info("reminderId =" + reminderId);
reminderAgent.getValidReminders().then((reminder) => {
if(reminder.length !== 0) {
if (reminder.length !== 0) {
let actionButton = reminder[0].actionButton;
if(actionButton.length === 0) {
actionButton = [{title: '?????'}]
if (actionButton.length === 0) {
actionButton = [{ title: '?????' }]
}
console.info('ActionButton title:' + actionButton[0].title);
console.info('ActionButton getValidReminders title:' + actionButton[0].title);
expect(actionButton[0].title).assertInstanceOf('String')
done()
}
},(error) => {
}, (error) => {
console.info('error.code getValidReminders 001 is :' + error.code)
});
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -101,25 +100,22 @@ describe('ReminderAgentTest', function () {
reminderAgent.publishReminder(timer).then((reminderId) => {
console.info("reminderId =" + reminderId);
reminderAgent.getValidReminders().then((reminder) => {
if(reminder.length !== 0) {
if (reminder.length !== 0) {
let actionButton = reminder[0].actionButton;
if(actionButton.length === 0) {
actionButton = [{type: 0}]
}
if (actionButton.length === 0) {
actionButton = [{ type: 0 }];
console.info('ActionButton type:' + actionButton[0].type);
expect(actionButton[0].type).assertEqual(0)
}
} else {
reminder = [{actionButton: [{type: 1}]}];
console.info('ActionButton Type: ' + reminder[0].actionButton[0].type);
expect(true).assertTrue();
reminder = [{ actionButton: [{ type: 1 }] }];
console.info('ActionButton getValidReminders Type: ' + reminder[0].actionButton[0].type);
}
},(error) => {
expect(false).assertTrue();
done()
}, (error) => {
console.info('error.code getValidReminders 002 is :' + error.code)
});
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -137,23 +133,23 @@ describe('ReminderAgentTest', function () {
abilityName: "ohos.samples.jshelloworld.MainAbility"
},
};
reminderAgent.cancelAllReminders().then((err, data) => {
console.info('err.code cancelAllReminders 003 is :' + err.code)
});
reminderAgent.publishReminder(timer).then((reminderId) => {
console.info("reminderId =" + reminderId);
reminderAgent.getValidReminders((err, reminder) => {
if(reminder.length !== 0) {
if (reminder.length !== 0) {
let wantAgent = reminder[0].wantAgent.abilityName;
if (wantAgent == "ohos.samples.jshelloworld.MainAbility") {
expect(true).assertTrue();
expect(wantAgent).assertInstanceOf('String');
} else {
expect(false).assertTrue();
console.info('err.code getValidReminders 003 is :' + err.code)
}
}
done()
});
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -167,25 +163,27 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: TRIGGER_TIME_IN_SECONDS
}
reminderAgent.cancelAllReminders().then((err, data) => {
console.info('err.code cancelAllReminders 004 is :' + err.code)
});
reminderAgent.publishReminder(timer).then((reminderId) => {
console.info("reminderId =" + reminderId);
reminderAgent.getValidReminders().then((reminder) => {
if(reminder.length !== 0) {
if (reminder.length !== 0) {
let maxScreenWantAgent = reminder[0].maxScreenWantAgent;
console.info('maxScreenWantAgent abilityName:' + maxScreenWantAgent.abilityName);
if (maxScreenWantAgent.abilityName === "") {
console.info("maxScreenWantAgent.abilityName value is ");
expect(true).assertEqual(true);
console.info("maxScreenWantAgent.abilityName value is " + maxScreenWantAgent.abilityName);
expect(maxScreenWantAgent.abilityName).assertEqual("");
}
} else {
reminder = [{maxScreenWantAgent: {abilityName: 'title.com.oh.phone.MainAbility'}}];
reminder = [{ maxScreenWantAgent: { abilityName: 'title.com.oh.phone.MainAbility' } }];
}
},(error) => {});
done()
}, (error) => {
console.info('error.code 004 is :' + error.code)
});
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -199,23 +197,25 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: TRIGGER_TIME_IN_SECONDS
}
reminderAgent.cancelAllReminders().then((err, data) => {
console.info('err.code cancelAllReminders 005 is :' + err.code)
});
reminderAgent.publishReminder(timer).then((reminderId) => {
console.info("reminderId =" + reminderId);
reminderAgent.getValidReminders().then((reminder) => {
if(reminder.length !== 0) {
if (reminder.length !== 0) {
let title = reminder[0].title;
console.info('ReminderRequest title:' + title);
expect(title).assertEqual("");
} else {
reminder = [{title: '????????'}];
reminder = [{ title: '????????' }];
console.info('ReminderRequest title:' + reminder[0].title);
}
},(error) => {});
done()
}, (error) => {
console.info('error.code 005 is :' + error.code)
});
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -229,23 +229,25 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: TRIGGER_TIME_IN_SECONDS
}
reminderAgent.cancelAllReminders().then((err, data) => {
console.info('err.code cancelAllReminders 006 is :' + err.code)
});
reminderAgent.publishReminder(timer).then((reminderId) => {
console.info("reminderId =" + reminderId);
reminderAgent.getValidReminders().then((reminder) => {
if(reminder.length !== 0) {
if (reminder.length !== 0) {
let content = reminder[0].content;
console.info('ReminderRequest content:' + content);
expect(content).assertEqual("");
} else {
reminder = [{content: '8????????????'}];
reminder = [{ content: '8????????????' }];
console.info('ReminderRequest content:' + reminder[0].content);
}
},(error) => {});
done()
}, (error) => {
console.info('error.code 006 is :' + error.code)
});
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -269,11 +271,8 @@ describe('ReminderAgentTest', function () {
reminderAgent.publishReminder(calendar).then((reminderId) => {
console.info("testReminderRequestType_007 reminderId =" + reminderId);
expect(reminderId).assertLarger(0);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -287,18 +286,15 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM,
hour: 7,
minute: 10,
daysOfWeek: [1,2,3,4,5]
daysOfWeek: [1, 2, 3, 4, 5]
}
reminderAgent.publishReminder(alarm).then((reminderId) => {
if (reminderId != -1) {
console.info("testReminderRequestType_008 reminderId =" + reminderId);
expect(reminderId).assertLarger(0);
done()
}
},error => {});
setTimeout(() => {
done();
},500);
}, error => { });
})
/**
......@@ -317,16 +313,12 @@ describe('ReminderAgentTest', function () {
expectId = reminderId + 1;
reminderAgent.publishReminder(timer).then((reminderId) => {
if (reminderId === expectId) {
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
console.info('reminderId 009 is :' + reminderId)
expect(reminderId).assertLarger(0);
done()
}
}, (error) => {
expect(false).assertTrue();
setTimeout(() => {
done();
}, 500);
console.info('error.code 009 is :' + error.code)
});
});
})
......@@ -344,13 +336,15 @@ describe('ReminderAgentTest', function () {
}
let expectId = -1;
function reminderCallback(err, reminderId) {
console.info('reminderId 010 is :' + reminderId)
expect(reminderId).assertEqual(expectId);
done();
}
reminderAgent.publishReminder(timer, (err, reminderId) => {
expectId = reminderId + 1;
console.info('expectId 010 is :' + expectId)
reminderAgent.publishReminder(timer, reminderCallback);
})
done();
})
/**
......@@ -364,12 +358,12 @@ describe('ReminderAgentTest', function () {
function reminderCallback(err, data) {
let i = 0;
expect(0).assertEqual(i);
done();
}
reminderAgent.addNotificationSlot(0, reminderCallback);
} catch(error) {
} catch (error) {
console.info('testAddNotificationSlotNorFun_011 slot err.code')
}
done();
})
/**
......@@ -381,21 +375,22 @@ describe('ReminderAgentTest', function () {
console.info('----------------------testAddNotificationSlotNorFun_012---------------------------');
let mySlot = null;
try {
reminderAgent.addNotificationSlot(mySlot,function(err) {
if(err == undefined) {
reminderAgent.addNotificationSlot(mySlot, function (err) {
if (err == undefined) {
console.info('testAddNotificationSlotNorFun_012 execute success');
} else {
console.info('testAddNotificationSlotNorFun_012 execute failed');
}
}).catch(function(err) {
}).catch(function (err) {
console.info("testAddNotificationSlotNorFun_012 execute catch" + err.code);
})
} catch(error) {
} catch (error) {
console.info("testAddNotificationSlotNorFun_012 execute try - catch" + error.code);
let i = 0;
expect(0).assertEqual(i);
done();
}})
}
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_XTS_013
......@@ -408,15 +403,11 @@ describe('ReminderAgentTest', function () {
type: 3
}
reminderAgent.addNotificationSlot(mySlot).then(() => {
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
console.info('mySliot.type 013 is :' + mySlot.type)
expect(mySlot.type).assertEqual(3);
done()
}, (error) => {
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
console.info('error.code 013 is :' + error.code)
});
})
......@@ -475,6 +466,7 @@ describe('ReminderAgentTest', function () {
setTimeout(() => {
reminderAgent.cancelAllReminders().then(() => {
reminderAgent.getValidReminders().then((reminders) => {
console.info('reminders.length 015 is :' + reminders.length);
expect(0).assertEqual(reminders.length);
});
});
......@@ -499,6 +491,7 @@ describe('ReminderAgentTest', function () {
setTimeout(() => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.getValidReminders().then((reminders) => {
console.info('reminders.length 016 is :' + reminders.length);
expect(0).assertEqual(reminders.length);
});
});
......@@ -532,6 +525,7 @@ describe('ReminderAgentTest', function () {
cancellength = reminders.length
firstdiff = publishlength - cancellength;
if (firstdiff === 0) {
console.info('firstdiff 017 is :' + firstdiff);
expect(0).assertEqual(firstdiff);
}
});
......@@ -566,6 +560,7 @@ describe('ReminderAgentTest', function () {
cancellength = reminders.length;
firstdiff = publishlength - cancellength;
if (firstdiff === 0) {
console.info('firstdiff 018 is :' + firstdiff);
expect(0).assertEqual(firstdiff);
}
});
......@@ -602,8 +597,10 @@ describe('ReminderAgentTest', function () {
cancellength = reminders.length;
firstdiff = publishlength - cancellength;
if (firstdiff === 0) {
console.info('firstdiff 019 is :' + firstdiff);
expect(0).assertEqual(firstdiff);
} else if (firstdiff === 1) {
console.info('firstdiff 019 is :' + firstdiff);
expect(1).assertEqual(firstdiff);
}
});
......@@ -640,8 +637,10 @@ describe('ReminderAgentTest', function () {
cancellength = reminders.length;
firstdiff = publishlength - cancellength;
if (firstdiff === 0) {
console.info('firstdiff 020 is :' + firstdiff);
expect(0).assertEqual(firstdiff);
} else if (firstdiff === 1) {
console.info('firstdiff 020 is :' + firstdiff);
expect(1).assertEqual(firstdiff);
}
});
......@@ -738,14 +737,11 @@ describe('ReminderAgentTest', function () {
let timer = {
triggerTimeInSeconds: 10
}
reminderAgent.publishReminder(timer,(err,reminderId) =>{
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testPublishReminderTimer_024 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -758,14 +754,12 @@ describe('ReminderAgentTest', function () {
let timer = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER
}
reminderAgent.publishReminder(timer,(err,reminderId) =>{
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testPublishReminderTimer_025 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -779,14 +773,11 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: -10
}
reminderAgent.publishReminder(timer,(err,reminderId) =>{
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testPublishReminderTimer_026 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -800,14 +791,11 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 0
}
reminderAgent.publishReminder(timer,(err,reminderId) =>{
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testPublishReminderTimer_027 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -821,14 +809,11 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 'fye'
}
reminderAgent.publishReminder(timer,(err,reminderId) =>{
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testPublishReminderTimer_028 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -842,14 +827,11 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 20
}
reminderAgent.publishReminder(timer,(err,reminderId) =>{
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testPublishReminderTimer_029 reminderId=" + reminderId);
expect(reminderId).assertLarger(0);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -863,14 +845,14 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 20
}
reminderAgent.cancelAllReminders().then((err,data) => {
console.info('err.code cancelAllReminders 030 is :' + err.code)
});
reminderAgent.publishReminder(timer).then((reminderId) => {
console.info("promise,the testPublishReminderTimer_030 reminderId =" + reminderId);
expect(reminderId).assertLarger(0);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -884,14 +866,11 @@ describe('ReminderAgentTest', function () {
hour: 11,
minute: 13
}
reminderAgent.publishReminder(alarm,(err,reminderId) =>{
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("promise,the testPublishReminderAlarm_031 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -905,14 +884,11 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM,
minute: 13
}
reminderAgent.publishReminder(alarm,(err,reminderId) =>{
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testPublishReminderAlarm_032 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -927,14 +903,11 @@ describe('ReminderAgentTest', function () {
hour: "11",
minute: 13
}
reminderAgent.publishReminder(alarm,(err,reminderId) =>{
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testPublishReminderAlarm_033 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -949,14 +922,11 @@ describe('ReminderAgentTest', function () {
hour: 24,
minute: 13
}
reminderAgent.publishReminder(alarm,(err,reminderId) =>{
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testPublishReminderAlarm_034 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -970,14 +940,11 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM,
hour: 11
}
reminderAgent.publishReminder(alarm,(err,reminderId) =>{
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testPublishReminderAlarm_035 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -992,14 +959,11 @@ describe('ReminderAgentTest', function () {
hour: 11,
minute: "13"
}
reminderAgent.publishReminder(alarm,(err,reminderId) =>{
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testPublishReminderAlarmNorFun_036 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1014,14 +978,11 @@ describe('ReminderAgentTest', function () {
hour: 11,
minute: 60
}
reminderAgent.publishReminder(alarm,(err,reminderId) =>{
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testPublishReminderAlarm_037 reminderId=" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1036,14 +997,11 @@ describe('ReminderAgentTest', function () {
hour: 11,
minute: 30
}
reminderAgent.publishReminder(alarm,(err,reminderId) =>{
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testPublishReminderAlarmFun_038 reminderId=" + reminderId);
expect(reminderId).assertLarger(0);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1058,14 +1016,11 @@ describe('ReminderAgentTest', function () {
hour: 11,
minute: 30
}
reminderAgent.publishReminder(alarm,(err,reminderId) =>{
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testPublishReminderAlarmFun_039 reminderId=" + reminderId);
expect(reminderId).assertLarger(0);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1083,12 +1038,11 @@ describe('ReminderAgentTest', function () {
}
reminderAgent.publishReminder(alarm).then((reminderId) => {
console.info("promise,the testPublishReminderAlarm_040 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
});
},(error) => {
console.info('error.code 040 is :' + error.code)
setTimeout(() => {
done();
},500);
done()
});
})
/**
......@@ -1107,11 +1061,8 @@ describe('ReminderAgentTest', function () {
reminderAgent.publishReminder(alarm).then((reminderId) => {
console.info("promise,the testPublishReminderAlarm_041 reminderId =" + reminderId);
expect(reminderId).assertLarger(0);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1131,14 +1082,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_042 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1158,14 +1106,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_043 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1186,14 +1131,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_044 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1213,14 +1155,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_045 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1241,14 +1180,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_046 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1269,14 +1205,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_047 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1297,14 +1230,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_048 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1324,14 +1254,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_049 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1352,14 +1279,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_050 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1380,14 +1304,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_051 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1408,14 +1329,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_052 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1435,14 +1353,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_053 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1463,14 +1378,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_054 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1491,14 +1403,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_055 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1518,14 +1427,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_056 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1546,14 +1452,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_057 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1574,14 +1477,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_058 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1602,14 +1502,11 @@ describe('ReminderAgentTest', function () {
second: 50
}
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendarFun_059 reminderId =" + reminderId);
expect(reminderId).assertLarger(0);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1633,11 +1530,8 @@ describe('ReminderAgentTest', function () {
reminderAgent.publishReminder(calendar).then((reminderId) => {
console.info("promise,the testPublishReminderCalendarFun_060 reminderId =" + reminderId);
expect(reminderId).assertLarger(0);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1659,14 +1553,11 @@ describe('ReminderAgentTest', function () {
},
repeatMonths: [13]
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_061 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1688,14 +1579,11 @@ describe('ReminderAgentTest', function () {
},
repeatMonths: [0]
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_062 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1717,14 +1605,11 @@ describe('ReminderAgentTest', function () {
},
repeatDays: [32]
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_063 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1746,14 +1631,11 @@ describe('ReminderAgentTest', function () {
},
repeatDays: [0]
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_064 reminderId =" + reminderId);
expect(-1).assertEqual(reminderId);
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1776,14 +1658,16 @@ describe('ReminderAgentTest', function () {
repeatMonths: [],
repeatDays: []
}
reminderAgent.publishReminder(calendar,(err,reminderId) => {
reminderAgent.cancelAllReminders().then(() => {
console.info('cancelAllReminders success')
reminderAgent.publishReminder(calendar, (err, reminderId) => {
console.info("callback,the testPublishReminderCalendar_065 reminderId =" + reminderId);
expect(reminderId).assertLager(0);
expect(reminderId).assertLarger(0);
done()
});
},(error) => {
console.info('error.code 065 is :' + error.code)
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1808,11 +1692,9 @@ describe('ReminderAgentTest', function () {
}
reminderAgent.publishReminder(calendar).then((reminderId) => {
console.info("promise,the testPublishReminderCalendar_066 reminderId =" + reminderId);
expect(reminderId).assertLarger(0)
done()
});
setTimeout(() => {
done();
},500);
})
/**
......@@ -1833,27 +1715,20 @@ describe('ReminderAgentTest', function () {
}
]
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersButton_067 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersButton_067 reminder length =" + reminder.length);
if (reminder.length!==0) {
let actionButton = reminder[0].actionButton;
if (actionButton.length === 0) {
expect(0).assertEqual(actionButton.length);
}
console.info("callback,the testGetValidRemindersButton_067 actionButton type: " +
actionButton[0].type);
}
},(error) =>{
expect(reminder.length).assertEqual(0);
done()
}, (error) => {
console.info('error.code 067 id :' + error.code)
});
},500);
done();
}, 2000);
})
/**
......@@ -1873,27 +1748,20 @@ describe('ReminderAgentTest', function () {
}
]
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersButton_068 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersButton_068 reminder length =" + reminder.length);
if (reminder.length!==0) {
let actionButton = reminder[0].actionButton;
if (actionButton.length === 0) {
expect(0).assertEqual(actionButton.length);
}
console.info("callback,the testGetValidRemindersButton_068 actionButton title: " +
actionButton[0].title);
}
},(error) =>{
expect(reminder.length).assertEqual(0);
done()
}, (error) => {
console.info('error.code 068 is :' + error.code)
});
},500);
done();
}, 500);
})
/**
......@@ -1914,27 +1782,20 @@ describe('ReminderAgentTest', function () {
}
]
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersButton_069 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersButton_069 reminder length =" + reminder.length);
if (reminder.length!==0) {
let actionButton = reminder[0].actionButton;
if (actionButton.length === 0) {
expect(0).assertEqual(actionButton.length);
}
console.info("callback,the testGetValidRemindersButton_069 actionButton title: " +
actionButton[0].title);
}
},(error) =>{
expect(reminder.length).assertEqual(0);
done()
}, (error) => {
console.info('error.code 069 is :' + error.code)
});
},500);
done();
}, 500);
})
/**
......@@ -1950,20 +1811,19 @@ describe('ReminderAgentTest', function () {
minute: 15,
snoozeTimes: 0
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersSnoozTimes_070 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersSnoozTimes_070 snoozeTimes =" +
reminder[0].snoozeTimes);
expect(reminder[0].snoozeTimes).assertEqual(0);
done()
});
},500);
done();
},500)
})
/**
......@@ -1979,20 +1839,19 @@ describe('ReminderAgentTest', function () {
minute: 15,
snoozeTimes: "2"
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersSnoozTimes_071 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersSnoozTimes_071 snoozeTimes =" +
reminder[0].snoozeTimes);
expect(reminder[0].snoozeTimes).assertEqual(0);
expect(reminder[0].snoozeTimes).assertEqual(3);
done()
});
},500);
done();
},500)
})
/**
......@@ -2008,20 +1867,19 @@ describe('ReminderAgentTest', function () {
minute: 15,
snoozeTimes: -1
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersSnoozTimes_072 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersSnoozTimes_072 snoozeTimes =" +
reminder[0].snoozeTimes);
expect(reminder[0].snoozeTimes).assertEqual(0);
done()
});
},500);
done();
},500)
})
/**
......@@ -2036,20 +1894,19 @@ describe('ReminderAgentTest', function () {
hour: 11,
minute: 13
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersRingDuration_073 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersRingDuration_073 ringDuration =" +
reminder[0].ringDuration);
expect(reminder[0].ringDuration).assertEqual(1);
expect(reminder[0].ringDuration).assertLarger(0);
done()
});
},500);
done();
}, 500);
})
/**
......@@ -2065,20 +1922,19 @@ describe('ReminderAgentTest', function () {
minute: 13,
ringDuration: "10"
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersRingDuration_074 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersRingDuration_074 ringDuration =" +
reminder[0].ringDuration);
expect(reminder[0].ringDuration).assertEqual(1);
expect(reminder[0].ringDuration).assertLarger(0);
done()
});
},500);
done();
}, 500);
})
/**
......@@ -2094,20 +1950,19 @@ describe('ReminderAgentTest', function () {
minute: 13,
ringDuration: -10
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersRingDuration_075 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersRingDuration_075 ringDuration =" +
reminder[0].ringDuration);
expect(reminder[0].ringDuration).assertEqual(1);
expect(reminder[0].ringDuration).assertLarger(0);
done()
});
},500);
done();
}, 500);
})
/**
......@@ -2122,20 +1977,19 @@ describe('ReminderAgentTest', function () {
hour: 11,
minute: 10
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersTimeInterval_076 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersTimeInterval_076 timeInterval =" +
reminder[0].timeInterval);
expect(reminder[0].timeInterval).assertEqual(0);
done()
});
},500);
done();
}, 500);
})
/**
......@@ -2151,20 +2005,19 @@ describe('ReminderAgentTest', function () {
minute: 10,
timeInterval: "3"
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersTimeInterval_077 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersTimeInterval_077 timeInterval =" +
reminder[0].timeInterval);
expect(reminder[0].timeInterval).assertEqual(0);
done()
});
},500);
done();
}, 500);
})
/**
......@@ -2180,20 +2033,19 @@ describe('ReminderAgentTest', function () {
minute: 10,
timeInterval: -12
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(alarm,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback,the testGetValidRemindersTimeInterval_078 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
reminderAgent.getValidReminders((err, reminder) => {
console.info("callback,the testGetValidRemindersTimeInterval_078 timeInterval =" +
reminder[0].timeInterval);
expect(reminder[0].timeInterval).assertEqual(0);
done()
});
},500);
done();
}, 500);
})
/**
......@@ -2210,22 +2062,21 @@ describe('ReminderAgentTest', function () {
ringDuration: 5,
title: ''
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersTitle_079 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let title = reminder[0].title;
console.info("callback,the testGetValidRemindersTitle_079 title is: " + title);
expect(title).assertEqual('');
expect(title).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2242,22 +2093,21 @@ describe('ReminderAgentTest', function () {
ringDuration: 10,
title: 123
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersTitle_080 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let title = reminder[0].title;
console.info("callback,the testGetValidRemindersTitle_080 title is: " + title);
expect(title).assertEqual('');
expect(title).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2271,22 +2121,21 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 20
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersSlotType_081 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let slotType = reminder[0].slotType;
console.info("callback,the testGetValidRemindersSlotType_081 slotType is: " + slotType);
expect(slotType).assertEqual(1);
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2301,22 +2150,17 @@ describe('ReminderAgentTest', function () {
triggerTimeInSeconds: 20,
slotType: 5
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersSlotType_082 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
let slotType = reminder[0].slotType;
console.info("callback,the testGetValidRemindersSlotType_082 slotType is: " + slotType);
expect(slotType).assertEqual(1);
}
reminderAgent.getValidReminders((err, reminder) => {
expect(reminder.length).assertEqual(0);
done()
});
},500);
done();
}, 500);
})
/**
......@@ -2334,22 +2178,21 @@ describe('ReminderAgentTest', function () {
abilityName: "com.oh.phone.MainAbility"
}
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersPkgName_083 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let pkgName = reminder[0].wantAgent.pkgName;
console.info("callback,the testGetValidRemindersPkgName_083 pkgName is: " + pkgName);
expect(pkgName).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2367,22 +2210,21 @@ describe('ReminderAgentTest', function () {
abilityName: "com.oh.phone.MainAbility"
}
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersPkgName_084 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let pkgName = reminder[0].wantAgent.pkgName;
console.info("callback,the testGetValidRemindersPkgName_084 pkgName is: " + pkgName);
expect(pkgName).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2400,23 +2242,22 @@ describe('ReminderAgentTest', function () {
abilityName: ""
}
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersAbilityName_085 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let abilityName = reminder[0].wantAgent.abilityName;
console.info("callback,the testGetValidRemindersAbilityName_085 abilityName is: " +
abilityName);
expect(abilityName).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2434,23 +2275,22 @@ describe('ReminderAgentTest', function () {
abilityName: 1243
}
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersAbilityName_086 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let abilityName = reminder[0].wantAgent.abilityName;
console.info("callback,the testGetValidRemindersAbilityName_086 abilityName is: " +
abilityName);
expect(abilityName).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2465,22 +2305,21 @@ describe('ReminderAgentTest', function () {
triggerTimeInSeconds: 20,
content: ""
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersContent_087 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let content = reminder[0].content;
console.info("callback,the testGetValidRemindersContent_087 content is: " + content);
expect(content).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2495,22 +2334,21 @@ describe('ReminderAgentTest', function () {
triggerTimeInSeconds: 20,
content: 14545
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersContent_088 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let content = reminder[0].content;
console.info("callback,the testGetValidRemindersContent_088 content is: " + content);
expect(content).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2525,23 +2363,22 @@ describe('ReminderAgentTest', function () {
triggerTimeInSeconds: 20,
expiredContent: ""
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersExpiredContent_089 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let expiredContent = reminder[0].expiredContent;
console.info("callback,the testGetValidRemindersExpiredContent_089 expiredContent is: " +
expiredContent);
expect(expiredContent).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2556,23 +2393,22 @@ describe('ReminderAgentTest', function () {
triggerTimeInSeconds: 20,
expiredContent: 14555
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersExpiredContent_090 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let expiredContent = reminder[0].expiredContent;
console.info("callback,the testGetValidRemindersExpiredContent_090 expiredContent is: " +
expiredContent);
expect(expiredContent).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2587,23 +2423,22 @@ describe('ReminderAgentTest', function () {
triggerTimeInSeconds: 20,
snoozeContent: ""
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersSnoozeContent_091 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let snoozeContent = reminder[0].snoozeContent;
console.info("callback,the testGetValidRemindersSnoozeContent_091 snoozeContent is: " +
snoozeContent);
expect(snoozeContent).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2618,22 +2453,21 @@ describe('ReminderAgentTest', function () {
triggerTimeInSeconds: 20,
snoozeContent: 2155
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersSnoozeContent_092 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let snoozeContent = reminder[0].snoozeContent;
console.info("callback,the snoozeContent is: " + snoozeContent);
expect(snoozeContent).assertEqual("");
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2648,23 +2482,22 @@ describe('ReminderAgentTest', function () {
triggerTimeInSeconds: 20,
notificationId: -1
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersNotificationId_093 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let notificationId = reminder[0].notificationId;
console.info("callback,the testGetValidRemindersNotificationId_093 notificationId is: " +
notificationId);
expect(notificationId).assertEqual(0);
expect(notificationId).assertEqual(-1);
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2679,23 +2512,22 @@ describe('ReminderAgentTest', function () {
triggerTimeInSeconds: 20,
notificationId: "100"
}
reminderAgent.cancelAllReminders((err,data) => {
reminderAgent.publishReminder(timer,(err,reminderId) => {
reminderAgent.cancelAllReminders((err, data) => {
reminderAgent.publishReminder(timer, (err, reminderId) => {
console.info("callback,the testGetValidRemindersNotificationId_094 reminderId =" + reminderId);
});
});
setTimeout(() => {
reminderAgent.getValidReminders((err,reminder) =>{
if (reminder.length !== 0){
reminderAgent.getValidReminders((err, reminder) => {
if (reminder.length !== 0) {
let notificationId = reminder[0].notificationId;
console.info("callback,the testGetValidRemindersNotificationId_094 notificationId is: " +
notificationId);
expect(notificationId).assertEqual(0);
done()
}
});
},500);
done();
}, 500);
})
/**
......@@ -2835,8 +2667,8 @@ describe('ReminderAgentTest', function () {
}, err => {
let i = 0;
expect(0).assertEqual(i);
done()
}).catch(res => { });
done();
})
/**
......@@ -2850,10 +2682,9 @@ describe('ReminderAgentTest', function () {
type: 1
}
reminderAgent.addNotificationSlot(tarRemoveSlot.type, (err, data) => {
console.info('addNotificationSlot 106 err code:'+err.code)
console.info('addNotificationSlot 106 err code:' + err.code)
});
reminderAgent.removeNotificationSlot(tarRemoveSlot.type, (err, data) => {
console.info('err code 106 is :' + err.code)
expect(err.code).assertEqual(67108888);
done();
......@@ -2910,9 +2741,8 @@ describe('ReminderAgentTest', function () {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 3
}
reminderAgent.cancelAllReminders().then(() => {})
reminderAgent.cancelAllReminders().then(() => { })
reminderAgent.publishReminder(timer).then((reminderId) => { });
reminderAgent.getValidReminders((err, reminders) => {
console.info('reminder length 109 is :' + reminders.length)
expect(reminders.length).assertEqual(0);
......@@ -2932,11 +2762,14 @@ describe('ReminderAgentTest', function () {
hour: 21,
minute: 14
}
reminderAgent.cancelAllReminders().then((err,data) => {
console.info('err.code 0110 is :' + err.code)
});
reminderAgent.publishReminder(alarm).then((reminderId) => {
console.info("promise the testPublishReminderNorAlarmFun_0110 remiderId =" + reminderId);
expect(reminderId).assertLarger(0);
done()
});
done();
})
/**
......@@ -2954,8 +2787,8 @@ describe('ReminderAgentTest', function () {
reminderAgent.publishReminder(alarm, (err, reminderId) => {
console.info("callback the testPublishReminderNorAlarmFun_0111 remiderId =" + reminderId);
expect(reminderId).assertLarger(0);
});
done();
});
})
/**
......@@ -3005,7 +2838,7 @@ describe('ReminderAgentTest', function () {
}
let calendar = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_CALENDAR,
dateTime : {
dateTime: {
year: 2025,
month: 10,
day: 10,
......@@ -3013,8 +2846,8 @@ describe('ReminderAgentTest', function () {
minute: 30
}
}
reminderAgent.publishReminder(timer).then((reminderId) => {});
reminderAgent.publishReminder(calendar).then((reminderId) => {});
reminderAgent.publishReminder(timer).then((reminderId) => { });
reminderAgent.publishReminder(calendar).then((reminderId) => { });
setTimeout(() => {
reminderAgent.cancelAllReminders().then(() => {
reminderAgent.getValidReminders().then((reminders) => {
......@@ -3034,42 +2867,42 @@ describe('ReminderAgentTest', function () {
console.info('----------------------testPublishReminderTypeCalendarFun_0114---------------------------');
let calendar = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_CALENDAR,
dateTime : {
dateTime: {
year: 2025,
month: 10,
day: 10,
hour: 23,
minute: 30
},
repeatMonths:[2],
repeatDays:[2],
actionButton:[
repeatMonths: [2],
repeatDays: [2],
actionButton: [
{
title:"close",
type:0
title: "close",
type: 0
},
{
title:"snooze",
type:1
title: "snooze",
type: 1
}
],
wantAgent:{
pkgName:"com.oh.phone",
abilityName:"com.oh.phone.MainAbility"
wantAgent: {
pkgName: "com.oh.phone",
abilityName: "com.oh.phone.MainAbility"
},
maxScreenWantAgent:{
pkgName:"com.oh.phone",
abilityName:"com.oh.phone.MainAbility"
maxScreenWantAgent: {
pkgName: "com.oh.phone",
abilityName: "com.oh.phone.MainAbility"
},
ringDuration:5,
snoozeTimes:2,
timeInterval:5,
title:"this is title",
content:"this is content",
expiredContent:"this reminder has expired",
snoozeContent:"remind later",
notificationId:100,
slotType:3
ringDuration: 5,
snoozeTimes: 2,
timeInterval: 5,
title: "this is title",
content: "this is content",
expiredContent: "this reminder has expired",
snoozeContent: "remind later",
notificationId: 100,
slotType: 3
}
reminderAgent.publishReminder(calendar).then((reminderId) => {
reminderAgent.getValidReminders().then((reminders) => {
......@@ -3116,7 +2949,7 @@ describe('ReminderAgentTest', function () {
it("testActionButtonType_0115", 0, async function (done) {
console.info('----------------------testActionButtonType_0115---------------------------');
let type1 = reminderAgent.ActionButtonType.ACTION_BUTTON_TYPE_CLOSE;
console.info(type1 + typeof(type1));
console.info(type1 + typeof (type1));
if (type1 == 0) {
expect(true).assertTrue();
} else {
......@@ -3133,7 +2966,7 @@ describe('ReminderAgentTest', function () {
it("testActionButtonType_0116", 0, async function (done) {
console.info('----------------------testActionButtonType_0116---------------------------');
let type1 = reminderAgent.ActionButtonType.ACTION_BUTTON_TYPE_SNOOZE;
console.info(type1 + typeof(type1));
console.info(type1 + typeof (type1));
if (type1 == 1) {
expect(true).assertTrue();
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册