trunk-tracking: port tests for r3935 which changes image lazyloading
This commit is contained in:
+18
-19
@@ -2016,20 +2016,19 @@ WGET_ARGS=""
|
||||
start_test lazyload_images,rewrite_images with critical images beacon
|
||||
HOST_NAME="http://imagebeacon.example.com"
|
||||
URL="$HOST_NAME/mod_pagespeed_test/image_rewriting/rewrite_images.html"
|
||||
# There are 3 images on rewrite_images.html. Check that they are all
|
||||
# lazyloaded by default.
|
||||
# There are 3 images on rewrite_images.html. Since beaconing is on but we've
|
||||
# lazyloaded by default.1951 # sent no beacon data, none should be lazy loaded.
|
||||
# Run until we see beaconing on the page (should happen on first visit).
|
||||
http_proxy=$SECONDARY_HOSTNAME\
|
||||
fetch_until -save -recursive $URL 'fgrep -c pagespeed_lazy_src=' 3
|
||||
check [ $(grep -c "^pagespeed\.CriticalImages\.Run" \
|
||||
$WGET_DIR/rewrite_images.html) = 1 ];
|
||||
fetch_until -save $URL \
|
||||
'fgrep -c "pagespeed.CriticalImages.Run"' 1
|
||||
check [ $(grep -c "pagespeed_lazy_src=" $FETCH_FILE) = 0 ];
|
||||
# We need the options hash and nonce to send a critical image beacon, so extract
|
||||
# it from injected beacon JS.
|
||||
OPTIONS_HASH=$(awk -F\' '/^pagespeed\.CriticalImages\.Run/ {print $(NF-3)}' \
|
||||
$WGET_DIR/rewrite_images.html)
|
||||
NONCE=$(awk -F\' '/^pagespeed\.CriticalImages\.Run/ {print $(NF-1)}' \
|
||||
$WGET_DIR/rewrite_images.html)
|
||||
OPTIONS_HASH=$(grep "^pagespeed\.CriticalImages\.Run" \
|
||||
$WGET_DIR/rewrite_images.html | awk -F\' '{print $(NF-3)}')
|
||||
OPTIONS_HASH=$(
|
||||
awk -F\' '/^pagespeed\.CriticalImages\.Run/ {print $(NF-3)}' $FETCH_FILE)
|
||||
NONCE=$(
|
||||
awk -F\' '/^pagespeed\.CriticalImages\.Run/ {print $(NF-1)}' $FETCH_FILE)
|
||||
# Send a beacon response using POST indicating that Puzzle.jpg is a critical
|
||||
# image.
|
||||
BEACON_URL="$HOST_NAME/ngx_pagespeed_beacon"
|
||||
@@ -2041,7 +2040,7 @@ OUT=$(env http_proxy=$SECONDARY_HOSTNAME \
|
||||
wget -q --save-headers -O - --no-http-keep-alive \
|
||||
--post-data "$BEACON_DATA" "$BEACON_URL")
|
||||
check_from "$OUT" egrep -q "HTTP/1[.]. 204"
|
||||
# Now only 2 of the images should be lazyloaded, Cuppa.png should not be.
|
||||
# Now 2 of the images should be lazyloaded, Puzzle.jpg should not be.
|
||||
http_proxy=$SECONDARY_HOSTNAME \
|
||||
fetch_until -save -recursive $URL 'fgrep -c pagespeed_lazy_src=' 2
|
||||
|
||||
@@ -2052,13 +2051,13 @@ http_proxy=$SECONDARY_HOSTNAME \
|
||||
# page without blocking.
|
||||
URL="$URL?id=4"
|
||||
http_proxy=$SECONDARY_HOSTNAME\
|
||||
fetch_until -save -recursive $URL 'fgrep -c pagespeed_lazy_src=' 3
|
||||
check [ $(grep -c "^pagespeed\.CriticalImages\.Run" \
|
||||
"$WGET_DIR/rewrite_images.html?id=4") = 1 ];
|
||||
OPTIONS_HASH=$(awk -F\' '/^pagespeed\.CriticalImages\.Run/ {print $(NF-3)}' \
|
||||
"$WGET_DIR/rewrite_images.html?id=4")
|
||||
NONCE=$(awk -F\' '/^pagespeed\.CriticalImages\.Run/ {print $(NF-1)}' \
|
||||
"$WGET_DIR/rewrite_images.html?id=4")
|
||||
fetch_until -save $URL \
|
||||
'fgrep -c "pagespeed.CriticalImages.Run"' 1
|
||||
check [ $(grep -c "pagespeed_lazy_src=" $FETCH_FILE) = 0 ];
|
||||
OPTIONS_HASH=$(
|
||||
awk -F\' '/^pagespeed\.CriticalImages\.Run/ {print $(NF-3)}' $FETCH_FILE)
|
||||
NONCE=$(
|
||||
awk -F\' '/^pagespeed\.CriticalImages\.Run/ {print $(NF-1)}' $FETCH_FILE)
|
||||
BEACON_URL="$HOST_NAME/ngx_pagespeed_beacon"
|
||||
BEACON_URL+="?url=http%3A%2F%2Fimagebeacon.example.com%2Fmod_pagespeed_test%2F"
|
||||
BEACON_URL+="image_rewriting%2Frewrite_images.html%3Fid%3D4"
|
||||
|
||||
Reference in New Issue
Block a user