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

Unified Diff: tools/android/loading/resource_sack_unittest.py

Issue 1837193002: Clovis: update resource sack to use new dependency graph. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 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
« no previous file with comments | « tools/android/loading/resource_sack_display_unittest.py ('k') | tools/android/loading/test_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/loading/resource_sack_unittest.py
diff --git a/tools/android/loading/resource_sack_unittest.py b/tools/android/loading/resource_sack_unittest.py
index a4b1a30ccee87ebfc381c8dc91236d4a57409a28..5c3e54d623f32855463de63212d8db1b63b65706 100644
--- a/tools/android/loading/resource_sack_unittest.py
+++ b/tools/android/loading/resource_sack_unittest.py
@@ -6,7 +6,7 @@ import unittest
import resource_sack
from test_utils import (MakeRequest,
- TestResourceGraph)
+ TestDependencyGraph)
class ResourceSackTestCase(unittest.TestCase):
@@ -15,15 +15,15 @@ class ResourceSackTestCase(unittest.TestCase):
requests = [MakeRequest(node_names[0], 'null')]
for n in node_names[1:]:
requests.append(MakeRequest(n, node_names[0]))
- return TestResourceGraph.FromRequestList(requests)
+ return TestDependencyGraph(requests)
def test_NodeMerge(self):
- g1 = TestResourceGraph.FromRequestList([
+ g1 = TestDependencyGraph([
MakeRequest(0, 'null'),
MakeRequest(1, 0),
MakeRequest(2, 0),
MakeRequest(3, 1)])
- g2 = TestResourceGraph.FromRequestList([
+ g2 = TestDependencyGraph([
MakeRequest(0, 'null'),
MakeRequest(1, 0),
MakeRequest(2, 0),
@@ -39,10 +39,10 @@ class ResourceSackTestCase(unittest.TestCase):
self.assertEqual(1, bag.num_nodes)
def test_MultiParents(self):
- g1 = TestResourceGraph.FromRequestList([
+ g1 = TestDependencyGraph([
MakeRequest(0, 'null'),
MakeRequest(2, 0)])
- g2 = TestResourceGraph.FromRequestList([
+ g2 = TestDependencyGraph([
MakeRequest(1, 'null'),
MakeRequest(2, 1)])
sack = resource_sack.GraphSack()
@@ -50,17 +50,21 @@ class ResourceSackTestCase(unittest.TestCase):
sack.ConsumeGraph(g2)
self.assertEqual(3, len(sack.bags))
labels = {bag.label: bag for bag in sack.bags}
+ def Predecessors(label):
+ bag = labels['%s/' % label]
+ return [e.from_node
+ for e in bag._sack._graph.InEdges(bag)]
self.assertEqual(
set(['0/', '1/']),
- set([bag.label for bag in labels['2/'].Predecessors()]))
- self.assertFalse(labels['0/'].Predecessors())
- self.assertFalse(labels['1/'].Predecessors())
+ set([bag.label for bag in Predecessors(2)]))
+ self.assertFalse(Predecessors(0))
+ self.assertFalse(Predecessors(1))
def test_Shortname(self):
root = MakeRequest(0, 'null')
shortname = MakeRequest(1, 0)
shortname.url = 'data:fake/content;' + 'lotsand' * 50 + 'lotsofdata'
- g1 = TestResourceGraph.FromRequestList([root, shortname])
+ g1 = TestDependencyGraph([root, shortname])
sack = resource_sack.GraphSack()
sack.ConsumeGraph(g1)
self.assertEqual(set(['0/', 'data:fake/content']),
« no previous file with comments | « tools/android/loading/resource_sack_display_unittest.py ('k') | tools/android/loading/test_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698