Bug 1021612 - test, r=michal
authorHonza Bambas <honzab.moz@firemni.cz>
Tue, 08 Jul 2014 16:48:01 +0200
changeset 192862 b94c916122c80098144b9e10ee1323b07f8302da
parent 192861 5f466ad69b218d2e52e9ab787f6008cdb8ff1f1c
child 192863 53a30a12d70ed9122fca579b0f4af9989d70a05a
push id7663
push userkwierso@gmail.com
push dateWed, 09 Jul 2014 03:08:08 +0000
treeherderfx-team@48de6f4f82af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal
bugs1021612
milestone33.0a1
Bug 1021612 - test, r=michal
netwerk/test/unit/data/4k-cache-file
netwerk/test/unit/test_bug1021612.js
netwerk/test/unit/xpcshell.ini
new file mode 100644
index 0000000000000000000000000000000000000000..ce66cc9e78f544a46c4a0541e95111515ada0c4e
GIT binary patch
literal 4096
zc%1Ff%}T>S5CGs6Z-IFCw&1n9o1}@Yd-JEXRjYyI;58&ux0vq6?9|$4@qIk_4&oE|
z4lYvg8HD{{U>JsBW;pje&+|Ob^E}V<y#M5_JN)e52_Xmj_;vREb-Yhcq(bbZ5Ur`J
zRvC*TePVT0D`3l23%pYu>EU?;7TFq5nTAX!r7PLaXbVh1)sR_P<|5`XO`?e2--N-X
z(FhvZE$By7k`71X)4yuD>p)V3R}>1@Z5R~Lzd$ePVpaFXnkBONybvRvg~0>M%@%rS
z*u_rLe3pxh5BYdN&x@SjP0BF1s?bd<Djd*gM6Wm6Z4sw5j%Aw3bV#QQ*F<Vn^%jt9
dSGqA<%i<(U$VS&@-ML$=o8N*ak$cI}#}CS*0rUU>
new file mode 100644
--- /dev/null
+++ b/netwerk/test/unit/test_bug1021612.js
@@ -0,0 +1,33 @@
+/*
+ * Bug 1021612 test.
+ */
+
+function make_channel(url, callback, ctx) {
+  var ios = Cc["@mozilla.org/network/io-service;1"].
+            getService(Ci.nsIIOService);
+  return ios.newChannel(url, "", null);
+}
+
+function checkSuccess(request, buffer)
+{
+  var body = '';
+  for (var i = 0; i < 3786; ++i)
+    body += '.';
+
+  do_check_eq(buffer, body);
+  do_test_finished();
+}
+
+function run_test()
+{
+  var profile = do_get_profile();
+  profile.append('cache2');
+  profile.append('entries');
+  var testFile = do_get_file('../unit/data/4k-cache-file');
+  testFile.copyTo(profile, '895F51A24BCC63EE6D69B3AAF0007975F33708A7');
+  var chan = make_channel('http://localhost/4k-cache-file.php');
+  chan.loadFlags = chan.loadFlags | Ci.nsIRequest.LOAD_FROM_CACHE;
+  chan.asyncOpen(new ChannelListener(checkSuccess, null),
+                 null);
+  do_test_pending();
+}
--- a/netwerk/test/unit/xpcshell.ini
+++ b/netwerk/test/unit/xpcshell.ini
@@ -1,12 +1,13 @@
 [DEFAULT]
 head = head_channels.js head_cache.js head_cache2.js
 tail =
 support-files =
+  data/4k-cache-file
   data/image.png
   data/system_root.lnk
   data/test_psl.txt
   data/test_readline1.txt
   data/test_readline2.txt
   data/test_readline3.txt
   data/test_readline4.txt
   data/test_readline5.txt
@@ -183,16 +184,17 @@ skip-if = os == "android"
 skip-if = os == "android"
 [test_bug712914_secinfo_validation.js]
 [test_bug770243.js]
 [test_bug894586.js]
 # Allocating 4GB might actually succeed on 64 bit machines
 skip-if = bits != 32
 [test_bug935499.js]
 [test_bug952927.js]
+[test_bug1021612.js]
 [test_doomentry.js]
 [test_cacheflags.js]
 # Bug 675039: intermittent fail on Android-armv6 
 skip-if = os == "android"
 [test_cache_jar.js]
 [test_channel_close.js]
 [test_compareURIs.js]
 [test_compressappend.js]