Merge m-c to inbound. a=merge

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-10-22 13:16:06 -04:00
commit a71d5a2b67
2 changed files with 14 additions and 27 deletions

View File

@ -122,7 +122,7 @@ class TestElements(MarionetteTestCase):
self.marionette.set_search_timeout(0)
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page")
def test_timeout_element(self):
def test_timeout(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
button = self.marionette.find_element("id", "createDivButton")
@ -131,15 +131,6 @@ class TestElements(MarionetteTestCase):
self.assertTrue(True, self.marionette.set_search_timeout(8000))
self.assertEqual(HTMLElement, type(self.marionette.find_element(By.ID, "newDiv")))
def test_timeout_elements(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
button = self.marionette.find_element("id", "createDivButton")
button.click()
self.assertEqual(len(self.marionette.find_elements(By.ID, "newDiv")), 0)
self.assertTrue(True, self.marionette.set_search_timeout(8000))
self.assertEqual(len(self.marionette.find_elements(By.ID, "newDiv")), 1)
def test_css_selector_scope_doesnt_start_at_rootnode(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)

View File

@ -293,23 +293,7 @@ ElementManager.prototype = {
}
let found = all ? this.findElements(values.using, values.value, win.document, startNode) :
this.findElement(values.using, values.value, win.document, startNode);
if (found == null || found.length <= 0) {
if (!searchTimeout || new Date().getTime() - startTime > searchTimeout) {
if (all) {
on_success([], command_id); // findElements should return empty list
} else {
on_error("Unable to locate element: " + values.value, 7, null, command_id);
}
} else {
values.time = startTime;
this.timer.initWithCallback(this.find.bind(this, win, values,
searchTimeout,
on_success, on_error, all,
command_id),
100,
Components.interfaces.nsITimer.TYPE_ONE_SHOT);
}
} else {
if (found) {
let type = Object.prototype.toString.call(found);
if ((type == '[object Array]') || (type == '[object HTMLCollection]') || (type == '[object NodeList]')) {
let ids = []
@ -323,6 +307,18 @@ ElementManager.prototype = {
on_success({'ELEMENT':id}, command_id);
}
return;
} else {
if (!searchTimeout || new Date().getTime() - startTime > searchTimeout) {
on_error("Unable to locate element: " + values.value, 7, null, command_id);
} else {
values.time = startTime;
this.timer.initWithCallback(this.find.bind(this, win, values,
searchTimeout,
on_success, on_error, all,
command_id),
100,
Components.interfaces.nsITimer.TYPE_ONE_SHOT);
}
}
},