Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #30520 from mwargers/1172460_2
Browse files Browse the repository at this point in the history
Bug 1172460 - Intermittent failure in test_sms_notification_removed_when_sms_deleted.py in wait_for_notification_toaster_displayed
  • Loading branch information
mwargers committed Jun 21, 2015
2 parents 77dd6b9 + 782d160 commit a20a867
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion tests/atoms/gaia_data_layer.js
Expand Up @@ -495,13 +495,17 @@ var GaiaDataLayer = {
};
},

sendSMS: function(recipient, content, aCallback) {
sendSMS: function(recipient, content, skipVerification, aCallback) {
// requires the 'sms' permission and the 'dom.sms.enabled' pref
var callback = aCallback || marionetteScriptFinished;
console.log('sending sms message to number: ' + recipient);

let messageManager = window.navigator.mozMobileMessage;
let request = messageManager.send(recipient, content);
if (skipVerification) {
marionetteScriptFinished(true);
return;
}

request.onsuccess = function(event) {
var sms = event.target.result;
Expand Down
4 changes: 2 additions & 2 deletions tests/python/gaia-ui-tests/gaiatest/gaia_test.py
Expand Up @@ -494,15 +494,15 @@ def sdcard_files(self, extension=''):
return [file for file in files if file['name'].endswith(extension)]
return files

def send_sms(self, number, message):
def send_sms(self, number, message, skip_verification=False):
self.marionette.switch_to_frame()
import json
number = json.dumps(number)
message = json.dumps(message)

self.marionette.push_permission('sms', True)
self.set_bool_pref('dom.sms.enabled', True)
result = self.marionette.execute_async_script('return GaiaDataLayer.sendSMS(%s, %s)' % (number, message))
result = self.marionette.execute_async_script('return GaiaDataLayer.sendSMS(%s, %s, %s)' % (number, message, str(skip_verification).lower()))
self.marionette.push_permission('sms', False)
self.clear_user_pref('dom.sms.enabled')

Expand Down
Expand Up @@ -19,7 +19,7 @@ def test_sms_notification(self):
system = System(self.marionette)

# Send a SMS to the device
self.data_layer.send_sms(self.environment.phone_numbers[0], _text_message_content)
self.data_layer.send_sms(self.environment.phone_numbers[0], _text_message_content, skip_verification=True)

# We will wait upto 300 seconds for the SMS to arrive due to network latency
system.wait_for_notification_toaster_displayed(timeout=300,
Expand Down
Expand Up @@ -25,7 +25,7 @@ def test_sms_notification_removed_when_sms_deleted(self):
messages.launch()

# Send a SMS to the device
self.data_layer.send_sms(self.environment.phone_numbers[0], _text_message_content)
self.data_layer.send_sms(self.environment.phone_numbers[0], _text_message_content, skip_verification=True)

system = System(self.marionette)

Expand Down

0 comments on commit a20a867

Please sign in to comment.