Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util_test.extjs |
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util_test.extjs |
index 2c75b9fc26bea3c972fe4f6d44892d6770432128..0d69c566992939ba86b9157c2965d94a5e543408 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util_test.extjs |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_util_test.extjs |
@@ -25,6 +25,10 @@ AutomationUtilE2ETest.prototype = { |
basicDoc: function() {/*! |
<p><a href='#'></a>hello</p> |
<h1><ul><li>a</ul><button></h1> |
+ */}, |
+ |
+ secondDoc: function() {/*! |
+ <html><head><title>Second doc</title></head><body>Second</body></html> |
*/} |
}; |
@@ -100,3 +104,23 @@ TEST_F('AutomationUtilE2ETest', 'GetDirection', function() { |
}); |
}); |
+ |
+TEST_F('AutomationUtilE2ETest', 'IsInSameWebpage', function() { |
+ this.runWithLoadedTree(this.basicDoc, function(root) { |
+ this.runWithLoadedTree(this.secondDoc, function(root2) { |
+ assertTrue(AutomationUtil.isInSameWebpage(root, root)); |
+ assertTrue(AutomationUtil.isInSameWebpage(root.firstChild, root)); |
+ assertTrue(AutomationUtil.isInSameWebpage(root, root.firstChild)); |
+ |
+ assertTrue(AutomationUtil.isInSameWebpage(root2, root2)); |
+ assertTrue(AutomationUtil.isInSameWebpage(root2.firstChild, root2)); |
+ assertTrue(AutomationUtil.isInSameWebpage(root2, root2.firstChild)); |
+ |
+ assertFalse(AutomationUtil.isInSameWebpage(root, root2)); |
+ assertFalse(AutomationUtil.isInSameWebpage(root.firstChild, root2)); |
+ assertFalse(AutomationUtil.isInSameWebpage(root2.firstChild)); |
+ assertFalse(AutomationUtil.isInSameWebpage( |
+ root.firstChild, root2.firstChild)); |
+ }); |
+ }); |
Peter Lundblad
2015/11/24 11:04:30
Could test with one node being in the desktop tree
dmazzoni
2015/11/30 22:00:46
All good ideas. I think it was worth adding a test
|
+}); |