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

Side by Side Diff: third_party/xdg-utils/tests/xdg-utils-usecases/t.01-default_mime_launch

Issue 151098: Patch from mdm@google.com... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 11 years, 5 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
Property Changes:
Name: svn:executable
+ *
OLDNEW
(Empty)
1 #!/bin/bash
2
3 . "$XDG_TEST_DIR/include/testassertions.sh"
4 . "$XDG_TEST_DIR/include/testcontrol.sh"
5
6 test_default_mime_launch() {
7
8 test_start "$FUNCNAME: verify we can install a mime type & associate it with an application"
9
10 test_init
11 require_notroot
12
13 # Set up files
14 use_file "$XDG_TEST_DIR/xdg-utils-usecases/data/mime_launch.xml" MIME_FILE
15 edit_file "$MIME_FILE" "x-xdg-testpattern" MIME2ND "x-$XDG_TEST_ID"
16 edit_file "$MIME_FILE" xdgtest EXTEN "xdgt-$XDG_TEST_SHORTID"
17
18 use_file "$XDG_TEST_DIR/xdg-utils-usecases/data/mime_launch.sh" SHELL_FILE
19
20 use_file "$XDG_TEST_DIR/xdg-utils-usecases/data/mime_launch.desktop" DESKTOP_FIL E
21 edit_file "$DESKTOP_FILE" "x-xdg-testpattern" TMP "$MIME2ND"
22 edit_file "$DESKTOP_FILE" '/tmp' TMP "$XDG_TEST_TMPDIR"
23 edit_file "$DESKTOP_FILE" 'include' TMP "$XDG_TEST_DIR/include"
24 edit_file "$DESKTOP_FILE" 'mime_launch.sh' TMP "$XDG_TEST_TMPDIR/$SHELL_FILE"
25
26 TEST_FILE="testfile.$EXTEN"
27 echo "Some text to make the textfile not empty" >"$TEST_FILE"
28
29 MIME_TYPE="text/$MIME2ND"
30
31 test_procedure
32
33 # Install Desktop file
34 assert_exit 0 xdg-desktop-menu install "$DESKTOP_FILE"
35 assert_nostdout
36 assert_nostderr
37
38 # Install Mime file
39 assert_exit 0 xdg-mime install "$MIME_FILE"
40 assert_nostdout
41 assert_nostderr
42
43 # Verify mimetype
44 echo "$MIME_TYPE" >out.expected
45 assert_exit 0 xdg-mime query filetype "$TEST_FILE"
46 MIME_INPUT=`cat out.stdout`
47 assert_stdout out.expected
48 assert_nostderr
49
50 # Verify application is as expected
51 echo "$DESKTOP_FILE" >out.expected
52 assert_exit 0 xdg-mime query default "$MIME_TYPE"
53 assert_stdout out.expected
54 assert_nostderr
55
56 # Verify correct application opens
57 assert_exit 0 xdg-open "$TEST_FILE"
58 assert_nostdout
59 assert_nostderr
60
61 echo "file: $XDG_TEST_TMPDIR/$TEST_FILE" >out.expect
62
63 # exec.out is created by xdg-open
64 assert_file "$XDG_TEST_TMPDIR/exec.out" 'out.expect'
65
66 #cleanup
67 assert_exit 0 xdg-desktop-menu uninstall "$DESKTOP_FILE"
68 assert_nostdout
69 assert_nostderr
70
71 assert_exit 0 xdg-mime uninstall "$MIME_FILE"
72 assert_nostdout
73 assert_nostderr
74
75 test_result
76 }
77 run_test test_default_mime_launch
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698