| 1 | use strict; |
|---|
| 2 | use warnings; |
|---|
| 3 | use Test::Base; |
|---|
| 4 | use HTTP::MobileAgent; |
|---|
| 5 | use HTTP::MobileAgent::Plugin::Charset; |
|---|
| 6 | |
|---|
| 7 | plan tests => 1*blocks; |
|---|
| 8 | |
|---|
| 9 | filters { |
|---|
| 10 | input => [qw/filt/], |
|---|
| 11 | expected => [qw/yaml/], |
|---|
| 12 | }; |
|---|
| 13 | |
|---|
| 14 | run_is_deeply input => 'expected'; |
|---|
| 15 | |
|---|
| 16 | sub filt { |
|---|
| 17 | my $ua = shift; |
|---|
| 18 | |
|---|
| 19 | local $ENV{HTTP_USER_AGENT} = $ua; |
|---|
| 20 | local $ENV{HTTP_ACCEPT_CHARSET}; |
|---|
| 21 | if ($ua =~ /DDIPOCKET/) { |
|---|
| 22 | $ENV{HTTP_ACCEPT_CHARSET} = |
|---|
| 23 | ( $ua =~ /K3001V/ ) |
|---|
| 24 | ? 'shift_jis, utf-8, utf-16, iso-8859-1;q=0.6, *;q=0.1' |
|---|
| 25 | : 'shift_jis; q=0.6, *;q=0.1'; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | my $agent = HTTP::MobileAgent->new; |
|---|
| 29 | +{ |
|---|
| 30 | can_display_utf8 => $agent->can_display_utf8 ? 'utf8' : 'no utf8', |
|---|
| 31 | }; |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | __END__ |
|---|
| 35 | |
|---|
| 36 | === |
|---|
| 37 | --- input: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.8) Gecko/20071019 Firefox/2.0.0.8 |
|---|
| 38 | --- expected |
|---|
| 39 | can_display_utf8: utf8 |
|---|
| 40 | |
|---|
| 41 | === docomo foma |
|---|
| 42 | --- input: DoCoMo/2.0 N905iBiz(c100;TJ) |
|---|
| 43 | --- expected |
|---|
| 44 | can_display_utf8: utf8 |
|---|
| 45 | |
|---|
| 46 | === docomo mova |
|---|
| 47 | --- input: DoCoMo/1.0/D501i |
|---|
| 48 | --- expected |
|---|
| 49 | can_display_utf8: no utf8 |
|---|
| 50 | |
|---|
| 51 | === |
|---|
| 52 | --- input: Vodafone/1.0/V802SE/SEJ001/SNXXXXXXXXX Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.10 |
|---|
| 53 | --- expected |
|---|
| 54 | can_display_utf8: utf8 |
|---|
| 55 | |
|---|
| 56 | === |
|---|
| 57 | --- input: J-PHONE/2.0/J-DN02 |
|---|
| 58 | --- expected |
|---|
| 59 | can_display_utf8: no utf8 |
|---|
| 60 | |
|---|
| 61 | === willcom |
|---|
| 62 | --- input: Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0 |
|---|
| 63 | --- expected |
|---|
| 64 | can_display_utf8: no utf8 |
|---|
| 65 | |
|---|
| 66 | === willcom |
|---|
| 67 | --- input: Mozilla/3.0(DDIPOCKET;KYOCERA/AH-K3001V/1.4.1.67.000000/0.1/C100) Opera 7.0 |
|---|
| 68 | --- expected |
|---|
| 69 | can_display_utf8: utf8 |
|---|
| 70 | |
|---|
| 71 | === ez |
|---|
| 72 | --- input: UP.Browser/3.01-HI01 UP.Link/3.4.5.2 |
|---|
| 73 | --- expected |
|---|
| 74 | can_display_utf8: no utf8 |
|---|
| 75 | |
|---|
| 76 | === ez |
|---|
| 77 | --- input: KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1 |
|---|
| 78 | --- expected |
|---|
| 79 | can_display_utf8: utf8 |
|---|
| 80 | |
|---|