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

Side by Side Diff: chrome/tools/build/mac/keystone_install_test.sh

Issue 2755007: Move the remainder of the installer-related files to chrome/installer/mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/tools/build/mac/build_app_dmg ('k') | chrome/tools/build/mac/pkg-dmg » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Test of the Mac Chrome installer.
8
9
10 # Where I am
11 DIR=$(dirname "${0}")
12
13 # My installer to test
14 INSTALLER="${DIR}"/keystone_install.sh
15 if [ ! -f "${INSTALLER}" ]; then
16 echo "Can't find scripts." >& 2
17 exit 1
18 fi
19
20 # What I test
21 PRODNAME="Google Chrome"
22 APPNAME="${PRODNAME}.app"
23 FWKNAME="${PRODNAME} Framework.framework"
24
25 # The version number for fake ksadmin to pretend to be
26 KSADMIN_VERSION_LIE="1.0.7.1306"
27
28 # Temp directory to be used as the disk image (source)
29 TEMPDIR=$(mktemp -d -t $(basename ${0}))
30 PATH=$PATH:"${TEMPDIR}"
31
32 # Clean up the temp directory
33 function cleanup_tempdir() {
34 chmod u+w "${TEMPDIR}"
35 rm -rf "${TEMPDIR}"
36 }
37
38 # Run the installer and make sure it fails.
39 # If it succeeds, we fail.
40 # Arg0: string to print
41 function fail_installer() {
42 echo $1
43 "${INSTALLER}" "${TEMPDIR}" >& /dev/null
44 RETURN=$?
45 if [ $RETURN -eq 0 ]; then
46 echo "Did not fail (which is a failure)" >& 2
47 cleanup_tempdir
48 exit 1
49 else
50 echo "Returns $RETURN"
51 fi
52 }
53
54 # Make sure installer works!
55 # Arg0: string to print
56 function pass_installer() {
57 echo $1
58 "${INSTALLER}" "${TEMPDIR}" >& /dev/null
59 RETURN=$?
60 if [ $RETURN -ne 0 ]; then
61 echo "FAILED; returned $RETURN but should have worked" >& 2
62 cleanup_tempdir
63 exit 1
64 else
65 echo "worked"
66 fi
67 }
68
69 # Make an old-style destination directory, to test updating from old-style
70 # versions to new-style versions.
71 function make_old_dest() {
72 DEST="${TEMPDIR}"/Dest.app
73 rm -rf "${DEST}"
74 mkdir -p "${DEST}"/Contents
75 defaults write "${DEST}/Contents/Info" KSVersion 0
76 cat >"${TEMPDIR}"/ksadmin <<EOF
77 #!/bin/sh
78 if [ "\${1}" = "--ksadmin-version" ] ; then
79 echo "${KSADMIN_VERSION_LIE}"
80 exit 0
81 fi
82 if [ -z "\${FAKE_SYSTEM_TICKET}" ] && [ "\${1}" = "-S" ] ; then
83 echo no system tix! >& 2
84 exit 1
85 fi
86 echo " xc=<KSPathExistenceChecker:0x45 path=${DEST}>"
87 exit 0
88 EOF
89 chmod u+x "${TEMPDIR}"/ksadmin
90 }
91
92 # Make a new-style destination directory, to test updating between new-style
93 # versions.
94 function make_new_dest() {
95 DEST="${TEMPDIR}"/Dest.app
96 rm -rf "${DEST}"
97 RSRCDIR="${DEST}/Contents/Versions/0/${FWKNAME}/Resources"
98 mkdir -p "${RSRCDIR}"
99 defaults write "${DEST}/Contents/Info" CFBundleShortVersionString 0
100 defaults write "${RSRCDIR}/Info" KSVersion 0
101 cat >"${TEMPDIR}"/ksadmin <<EOF
102 #!/bin/sh
103 if [ "\${1}" = "--ksadmin-version" ] ; then
104 echo "${KSADMIN_VERSION_LIE}"
105 exit 0
106 fi
107 if [ -z "\${FAKE_SYSTEM_TICKET}" ] && [ "\${1}" = "-S" ] ; then
108 echo no system tix! >& 2
109 exit 1
110 fi
111 echo " xc=<KSPathExistenceChecker:0x45 path=${DEST}>"
112 exit 0
113 EOF
114 chmod u+x "${TEMPDIR}"/ksadmin
115 }
116
117 # Make a simple source directory - the update that is to be applied
118 function make_src() {
119 chmod ugo+w "${TEMPDIR}"
120 rm -rf "${TEMPDIR}/${APPNAME}"
121 RSRCDIR="${TEMPDIR}/${APPNAME}/Contents/Versions/1/${FWKNAME}/Resources"
122 mkdir -p "${RSRCDIR}"
123 defaults write "${TEMPDIR}/${APPNAME}/Contents/Info" \
124 CFBundleShortVersionString "1"
125 defaults write "${RSRCDIR}/Info" \
126 KSProductID "com.google.Chrome"
127 defaults write "${RSRCDIR}/Info" \
128 KSVersion "2"
129 }
130
131 function make_basic_src_and_dest() {
132 make_src
133 make_new_dest
134 }
135
136 fail_installer "No source anything"
137
138 mkdir "${TEMPDIR}"/"${APPNAME}"
139 fail_installer "No source bundle"
140
141 make_basic_src_and_dest
142 chmod ugo-w "${TEMPDIR}"
143 fail_installer "Writable dest directory"
144
145 make_basic_src_and_dest
146 fail_installer "Was no KSUpdateURL in dest after copy"
147
148 make_basic_src_and_dest
149 defaults write \
150 "${TEMPDIR}/${APPNAME}/Contents/Versions/1/${FWKNAME}/Resources/Info" \
151 KSUpdateURL "http://foo.bar"
152 export FAKE_SYSTEM_TICKET=1
153 fail_installer "User and system ticket both present"
154 export -n FAKE_SYSTEM_TICKET
155
156 make_src
157 make_old_dest
158 defaults write \
159 "${TEMPDIR}/${APPNAME}/Contents/Versions/1/${FWKNAME}/Resources/Info" \
160 KSUpdateURL "http://foo.bar"
161 pass_installer "Old-style update"
162
163 make_basic_src_and_dest
164 defaults write \
165 "${TEMPDIR}/${APPNAME}/Contents/Versions/1/${FWKNAME}/Resources/Info" \
166 KSUpdateURL "http://foo.bar"
167 pass_installer "ALL"
168
169 cleanup_tempdir
OLDNEW
« no previous file with comments | « chrome/tools/build/mac/build_app_dmg ('k') | chrome/tools/build/mac/pkg-dmg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698