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

Side by Side Diff: third_party/mozprofile/tests/addonid.py

Issue 108313011: Adding mozilla libraries required by Firefox interop test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/mozprofile/setup.py ('k') | third_party/mozprofile/tests/bug758250.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
Added: svn:executable
+ *
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 import os
4 import tempfile
5 import unittest
6 import shutil
7 from mozprofile import addons
8
9 class AddonIDTest(unittest.TestCase):
10 """ Test finding the addon id in a variety of install.rdf styles """
11
12 def make_install_rdf(self, filecontents):
13 path = tempfile.mkdtemp()
14 f = open(os.path.join(path, "install.rdf"), "w")
15 f.write(filecontents)
16 f.close()
17 return path
18
19 def test_addonID(self):
20 testlist = self.get_test_list()
21 for t in testlist:
22 try:
23 p = self.make_install_rdf(t)
24 a = addons.AddonManager(os.path.join(p, "profile"))
25 addon_id = a.addon_details(p)['id']
26 self.assertTrue(addon_id == "winning", "We got the addon id")
27 finally:
28 shutil.rmtree(p)
29
30 def get_test_list(self):
31 """ This just returns a hardcoded list of install.rdf snippets for testi ng.
32 When adding snippets for testing, remember that the id we're looking for
33 is "winning" (no quotes). So, make sure you have that id in your sn ippet
34 if you want it to pass.
35 """
36 tests = [
37 """<?xml version="1.0"?>
38 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
39 xmlns:em="http://www.mozilla.org/2004/em-rdf#">
40 <Description about="urn:mozilla:install-manifest">
41 <em:id>winning</em:id>
42 <em:name>MozMill</em:name>
43 <em:version>2.0a</em:version>
44 <em:creator>Adam Christian</em:creator>
45 <em:description>A testing extension based on the Windmill Testing Framework client source</em:description>
46 <em:unpack>true</em:unpack>
47 <em:targetApplication>
48 <!-- Firefox -->
49 <Description>
50 <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
51 <em:minVersion>3.5</em:minVersion>
52 <em:maxVersion>8.*</em:maxVersion>
53 </Description>
54 </em:targetApplication>
55 <em:targetApplication>
56 <!-- Thunderbird -->
57 <Description>
58 <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
59 <em:minVersion>3.0a1pre</em:minVersion>
60 <em:maxVersion>3.2*</em:maxVersion>
61 </Description>
62 </em:targetApplication>
63 <em:targetApplication>
64 <!-- Sunbird -->
65 <Description>
66 <em:id>{718e30fb-e89b-41dd-9da7-e25a45638b28}</em:id>
67 <em:minVersion>0.6a1</em:minVersion>
68 <em:maxVersion>1.0pre</em:maxVersion>
69 </Description>
70 </em:targetApplication>
71 <em:targetApplication>
72 <!-- SeaMonkey -->
73 <Description>
74 <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
75 <em:minVersion>2.0a1</em:minVersion>
76 <em:maxVersion>2.1*</em:maxVersion>
77 </Description>
78 </em:targetApplication>
79 <em:targetApplication>
80 <!-- Songbird -->
81 <Description>
82 <em:id>songbird@songbirdnest.com</em:id>
83 <em:minVersion>0.3pre</em:minVersion>
84 <em:maxVersion>1.3.0a</em:maxVersion>
85 </Description>
86 </em:targetApplication>
87 <em:targetApplication>
88 <Description>
89 <em:id>toolkit@mozilla.org</em:id>
90 <em:minVersion>1.9.1</em:minVersion>
91 <em:maxVersion>2.0*</em:maxVersion>
92 </Description>
93 </em:targetApplication>
94 </Description>
95 </RDF>""",
96 """<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
97 xmlns:em="http://www.mozilla.org/2004/em-rdf#">
98 <Description about="urn:mozilla:install-manifest">
99 <em:targetApplication>
100 <!-- Firefox -->
101 <Description>
102 <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
103 <em:minVersion>3.5</em:minVersion>
104 <em:maxVersion>8.*</em:maxVersion>
105 </Description>
106 </em:targetApplication>
107 <em:id>winning</em:id>
108 <em:name>MozMill</em:name>
109 <em:version>2.0a</em:version>
110 <em:creator>Adam Christian</em:creator>
111 <em:description>A testing extension based on the Windmill Testing Framework client source</em:description>
112 <em:unpack>true</em:unpack>
113 </Description>
114 </RDF>""",
115 """<RDF xmlns="http://www.mozilla.org/2004/em-rdf#"
116 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
117 <rdf:Description about="urn:mozilla:install-manifest">
118 <id>winning</id>
119 <name>foo</name>
120 <version>42</version>
121 <description>A testing extension based on the Windmill Testing Framework cl ient source</description>
122 </rdf:Description>
123 </RDF>""",
124 """<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
125 xmlns:foobar="http://www.mozilla.org/2004/em-rdf#">
126 <Description about="urn:mozilla:install-manifest">
127 <foobar:targetApplication>
128 <!-- Firefox -->
129 <Description>
130 <foobar:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</foobar:id>
131 <foobar:minVersion>3.5</foobar:minVersion>
132 <foobar:maxVersion>8.*</foobar:maxVersion>
133 </Description>
134 </foobar:targetApplication>
135 <foobar:id>winning</foobar:id>
136 <foobar:name>MozMill</foobar:name>
137 <foobar:version>2.0a</foobar:version>
138 <foobar:creator>Adam Christian</foobar:creator>
139 <foobar:description>A testing extension based on the Windmill Testing Frame work client source</foobar:description>
140 <foobar:unpack>true</foobar:unpack>
141 </Description>
142 </RDF>"""]
143 return tests
144
145 if __name__ == '__main__':
146 unittest.main()
OLDNEW
« no previous file with comments | « third_party/mozprofile/setup.py ('k') | third_party/mozprofile/tests/bug758250.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698