llmediaentry_test.cpp
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:19k
源码类别:

游戏引擎

开发平台:

C++ Builder

  1. /** 
  2.  * @file llmediaentry_test.cpp
  3.  * @brief llmediaentry unit tests
  4.  *
  5.  * $LicenseInfo:firstyear=2001&license=viewergpl$
  6.  * 
  7.  * Copyright (c) 2001-2010, Linden Research, Inc.
  8.  * 
  9.  * Second Life Viewer Source Code
  10.  * The source code in this file ("Source Code") is provided by Linden Lab
  11.  * to you under the terms of the GNU General Public License, version 2.0
  12.  * ("GPL"), unless you have obtained a separate licensing agreement
  13.  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  14.  * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15.  * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16.  * 
  17.  * There are special exceptions to the terms and conditions of the GPL as
  18.  * it is applied to this Source Code. View the full text of the exception
  19.  * in the file doc/FLOSS-exception.txt in this software distribution, or
  20.  * online at
  21.  * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22.  * 
  23.  * By copying, modifying or distributing this software, you acknowledge
  24.  * that you have read and understood your obligations described above,
  25.  * and agree to abide by those obligations.
  26.  * 
  27.  * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28.  * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29.  * COMPLETENESS OR PERFORMANCE.
  30.  * $/LicenseInfo$
  31.  */
  32. #include "linden_common.h"
  33. #include "lltut.h"
  34. #if LL_WINDOWS
  35. #pragma warning (push)
  36. #pragma warning (disable : 4702) // boost::lexical_cast generates this warning
  37. #endif
  38. #include <boost/lexical_cast.hpp>
  39. #if LL_WINDOWS
  40. #pragma warning (pop)
  41. #endif
  42. #include "llstring.h"
  43. #include "llsdutil.h"
  44. #include "llsdserialize.h"
  45. #include "../llmediaentry.h"
  46. #include "lllslconstants.h"
  47. #define DEFAULT_MEDIA_ENTRY "<llsd>n
  48.  <map>n
  49.  <key>alt_image_enable</key>n
  50.  <boolean>0</boolean>n
  51.  <key>auto_loop</key>n
  52.  <boolean>0</boolean>n
  53.  <key>auto_play</key>n
  54.  <boolean>0</boolean>n
  55.  <key>auto_scale</key>n
  56.  <boolean>0</boolean>n
  57.  <key>auto_zoom</key>n
  58.  <boolean>0</boolean>n
  59.  <key>controls</key>n
  60.  <integer>0</integer>n
  61.  <key>current_url</key>n
  62.  <string />n
  63.  <key>first_click_interact</key>n
  64.  <boolean>0</boolean>n
  65.  <key>height_pixels</key>n
  66.  <integer>0</integer>n
  67.  <key>home_url</key>n
  68.  <string />n
  69.  <key>perms_control</key>n
  70.  <integer>7</integer>n
  71.  <key>perms_interact</key>n
  72.  <integer>7</integer>n
  73.  <key>whitelist_enable</key>n
  74.  <boolean>0</boolean>n
  75.  <key>width_pixels</key>n
  76.  <integer>0</integer>n
  77.  </map>n
  78.  </llsd>"
  79. #define EMPTY_MEDIA_ENTRY "<llsd>n
  80.  <map>n
  81.  <key>alt_image_enable</key>n
  82.  <boolean>0</boolean>n
  83.  <key>auto_loop</key>n
  84.  <boolean>0</boolean>n
  85.  <key>auto_play</key>n
  86.  <boolean>0</boolean>n
  87.  <key>auto_scale</key>n
  88.  <boolean>0</boolean>n
  89.  <key>auto_zoom</key>n
  90.  <boolean>0</boolean>n
  91.  <key>controls</key>n
  92.  <integer>0</integer>n
  93.  <key>current_url</key>n
  94.  <string />n
  95.  <key>first_click_interact</key>n
  96.  <boolean>0</boolean>n
  97.  <key>height_pixels</key>n
  98.  <integer>0</integer>n
  99.  <key>home_url</key>n
  100.  <string />n
  101.  <key>perms_control</key>n
  102.  <integer>0</integer>n
  103.  <key>perms_interact</key>n
  104.  <integer>0</integer>n
  105.  <key>whitelist_enable</key>n
  106.  <boolean>0</boolean>n
  107.  <key>width_pixels</key>n
  108.  <integer>0</integer>n
  109.  </map>n
  110.  </llsd>"
  111. #define PARTIAL_MEDIA_ENTRY(CURRENT_URL) "<llsd>n
  112.  <map>n
  113.  <key>alt_image_enable</key>n
  114.  <boolean>0</boolean>n
  115.  <key>auto_loop</key>n
  116.  <boolean>0</boolean>n
  117.  <key>auto_play</key>n
  118.  <boolean>0</boolean>n
  119.  <key>auto_scale</key>n
  120.  <boolean>0</boolean>n
  121.  <key>auto_zoom</key>n
  122.  <boolean>0</boolean>n
  123.  <key>controls</key>n
  124.  <integer>0</integer>n
  125.  <key>current_url</key>n
  126.  <string>" CURRENT_URL "</string>n
  127.  <key>first_click_interact</key>n
  128.  <boolean>0</boolean>n
  129.  <key>height_pixels</key>n
  130.  <integer>0</integer>n
  131.  <key>home_url</key>n
  132.  <string />n
  133.  <key>perms_control</key>n
  134.  <integer>0</integer>n
  135.  <key>perms_interact</key>n
  136.  <integer>0</integer>n
  137.  <key>whitelist_enable</key>n
  138.  <boolean>0</boolean>n
  139.  <key>width_pixels</key>n
  140.  <integer>0</integer>n
  141.  </map>n
  142.  </llsd>"
  143. namespace tut
  144. {
  145.     // this is fixture data that gets created before each test and destroyed
  146.     // after each test.  this is where we put all of the setup/takedown code
  147.     // and data needed for each test.
  148.     struct MediaEntry_test
  149.     {
  150.         MediaEntry_test() {
  151.             emptyMediaEntryStr = EMPTY_MEDIA_ENTRY;
  152.             std::istringstream e(EMPTY_MEDIA_ENTRY);
  153.             LLSDSerialize::fromXML(emptyMediaEntryLLSD, e);
  154.             defaultMediaEntryStr = DEFAULT_MEDIA_ENTRY;
  155.             std::istringstream d(DEFAULT_MEDIA_ENTRY);
  156.             LLSDSerialize::fromXML(defaultMediaEntryLLSD, d);
  157.         }     
  158.         std::string emptyMediaEntryStr;
  159.         LLSD emptyMediaEntryLLSD;
  160.         std::string defaultMediaEntryStr;
  161.         LLSD defaultMediaEntryLLSD;
  162.     };
  163.     typedef test_group<MediaEntry_test, 55> factory;
  164.     typedef factory::object object;
  165. }
  166.         
  167. namespace
  168. {
  169.     // this is for naming our tests to make pretty output
  170.     tut::factory tf("MediaEntry Test");
  171. }
  172. namespace tut
  173. {
  174.     void ensure_llsd_equals(const std::string& msg, const LLSD& expected, const LLSD& actual)
  175.     {
  176.         if (!llsd_equals(expected, actual))
  177.         {
  178.             std::string message = msg;
  179.             message += ": actual: ";
  180.             message += ll_pretty_print_sd(actual);
  181.             message += "n  expected: ";
  182.             message += ll_pretty_print_sd(expected);
  183.             message += "n";
  184.             ensure(message, false);
  185.         }
  186.     }
  187.     void ensure_string_equals(const std::string& msg, const std::string& expected, const std::string& actual)
  188.     {
  189.         if ( expected != actual )
  190.         {
  191.             std::string message = msg;
  192.             message += ": actual: ";
  193.             message += actual;
  194.             message += "n  expected: ";
  195.             message += expected;
  196.             message += "n";
  197.             ensure(message, false);
  198.         }
  199.     }
  200.     void set_whitelist(LLMediaEntry &entry, const char *str)
  201.     {
  202.         std::vector<std::string> tokens;
  203.         LLStringUtil::getTokens(std::string(str), tokens, ",");
  204.         entry.setWhiteList(tokens);
  205.     }
  206.     void whitelist_test(int num, bool enable, const char *whitelist, const char *candidate_url, bool expected_pass)
  207.     {
  208.         std::string message = "Whitelist test " + boost::lexical_cast<std::string>(num);
  209.         LLMediaEntry entry;
  210.         entry.setWhiteListEnable(enable);
  211.         set_whitelist(entry, whitelist);
  212.         bool passed_whitelist = entry.checkCandidateUrl(candidate_url);
  213.         if (passed_whitelist != expected_pass)
  214.         {
  215.             message += " failed: expected ";
  216.             message += (expected_pass) ? "" : "NOT ";
  217.             message += "to matchnwhitelist = ";
  218.             message += whitelist;
  219.             message += "ncandidate_url = ";
  220.             message += candidate_url;
  221.         }
  222.         ensure(message, expected_pass == passed_whitelist);
  223.     }
  224.     void whitelist_test(int num, const char *whitelist, const char *candidate_url, bool expected_pass)
  225.     {
  226.         whitelist_test(num, true, whitelist, candidate_url, expected_pass);
  227.     }
  228.     void whitelist_test(int num, const char *whitelist, const char *candidate_url)
  229.     {
  230.         whitelist_test(num, true, whitelist, candidate_url, true);
  231.     }
  232. template<> template<>
  233. void object::test<1>()
  234. {
  235. set_test_name("Test LLMediaEntry Instantiation");
  236. LLMediaEntry entry;
  237.         ensure_llsd_equals(get_test_name() + " failed", defaultMediaEntryLLSD, entry.asLLSD());
  238. }
  239. template<> template<>
  240. void object::test<2>()
  241. {
  242. set_test_name("Test LLMediaEntry Instantiation from LLSD");
  243.         LLMediaEntry entry;
  244.         LLSD sd;
  245.         entry.fromLLSD(sd);
  246.         ensure_llsd_equals(get_test_name() + " failed", emptyMediaEntryLLSD, entry.asLLSD());
  247.     }
  248.     template<> template<>
  249.     void object::test<3>()
  250.     {
  251.         set_test_name("Test LLMediaEntry Partial Instantiation from LLSD");
  252.         LLMediaEntry entry;
  253.         LLSD sd;
  254.         sd[LLMediaEntry::CURRENT_URL_KEY] = "http://www.example.com";
  255.         entry.fromLLSD(sd);
  256.         LLSD golden;
  257.         std::istringstream p(PARTIAL_MEDIA_ENTRY("http://www.example.com"));
  258.         LLSDSerialize::fromXML(golden,p);
  259.         ensure_llsd_equals(get_test_name() + " failed", golden, entry.asLLSD());
  260.     }
  261.     template<> template<>
  262.     void object::test<4>()
  263.     {
  264.         set_test_name("Test LLMediaEntry::asLLSD()");
  265.         LLMediaEntry entry;
  266.         LLSD sd;
  267. // Put some cruft in the LLSD
  268.         sd[LLMediaEntry::CURRENT_URL_KEY] = "http://www.example.com";
  269. LLSD whitelist;
  270. whitelist.append("*.example.com");
  271.         sd[LLMediaEntry::WHITELIST_KEY] = whitelist;
  272.         entry.asLLSD(sd);
  273.         ensure_llsd_equals(get_test_name() + " failed", defaultMediaEntryLLSD, sd);
  274.     }
  275.     template<> template<>
  276.     void object::test<5>()
  277.     {
  278.         set_test_name("Test LLMediaEntry::asLLSD() -> LLMediaEntry::fromLLSD()");
  279.         LLMediaEntry entry1, entry2;
  280. // Add a whitelist to entry2
  281. std::vector<std::string> whitelist;
  282. whitelist.push_back("*.example.com");
  283.         entry2.setWhiteList(whitelist);
  284. // Render entry1 (which has no whitelist) as an LLSD
  285.         LLSD sd;
  286. entry1.asLLSD(sd);
  287. // "read" that LLSD into entry 2
  288. entry2.fromLLSD(sd);
  289.         ensure_llsd_equals(get_test_name() + " failed", defaultMediaEntryLLSD, entry2.asLLSD());
  290.     }
  291.     // limit tests
  292.     const char *URL_OK = "http://www.example.com";
  293.     const char *URL_TOO_BIG = "http://www.example.com.qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";
  294.     template<> template<>
  295.     void object::test<6>()
  296.     {
  297.         set_test_name("Test Limits on setting current URL");
  298.         LLMediaEntry entry;
  299.         U32 status = entry.setCurrentURL(URL_OK);
  300.         ensure(get_test_name() + " ok failed", status == LSL_STATUS_OK);
  301.         status = entry.setCurrentURL(URL_TOO_BIG);
  302.         ensure(get_test_name() + " ok failed", status == LSL_STATUS_BOUNDS_ERROR);
  303.     }    
  304.     template<> template<>
  305.     void object::test<7>()
  306.     {
  307.         set_test_name("Test Limits on setting home URL");
  308.         LLMediaEntry entry;
  309.         U32 status = entry.setHomeURL(URL_OK);
  310.         ensure(get_test_name() + " ok failed", status == LSL_STATUS_OK);
  311.         status = entry.setHomeURL(URL_TOO_BIG);
  312.         ensure(get_test_name() + " ok failed", status == LSL_STATUS_BOUNDS_ERROR);
  313.     }
  314.     template<> template<>
  315.     void object::test<8>()
  316.     {
  317.         set_test_name("Test Limits on setting whitelist");
  318.         
  319.         // Test a valid list
  320.         LLMediaEntry entry;
  321.         std::vector<std::string> whitelist;
  322.         whitelist.push_back(std::string(URL_OK));
  323.         S32 status = entry.setWhiteList(whitelist);
  324.         ensure(get_test_name() + " invalid result", status == LSL_STATUS_OK);
  325.         ensure(get_test_name() + " failed", whitelist == entry.getWhiteList());
  326.     }
  327.     template<> template<>
  328.     void object::test<9>()
  329.     {
  330.         set_test_name("Test Limits on setting whitelist too big");
  331.         
  332.         // Test an invalid list
  333.         LLMediaEntry entry;
  334.         std::vector<std::string> whitelist, empty;
  335.         whitelist.push_back(std::string(URL_OK));
  336.         whitelist.push_back(std::string(URL_TOO_BIG));
  337.         S32 status = entry.setWhiteList(whitelist);
  338.         ensure(get_test_name() + " invalid result", status == LSL_STATUS_BOUNDS_ERROR);
  339.         ensure(get_test_name() + " failed", empty == entry.getWhiteList());
  340.     }
  341.     template<> template<>
  342.     void object::test<10>()
  343.     {
  344.         set_test_name("Test Limits on setting whitelist too many");
  345.         
  346.         // Test an invalid list
  347.         LLMediaEntry entry;
  348.         std::vector<std::string> whitelist, empty;
  349.         for (int i=0; i < LLMediaEntry::MAX_WHITELIST_SIZE+1; i++) {
  350.             whitelist.push_back("Q");
  351.         }
  352.         S32 status = entry.setWhiteList(whitelist);
  353.         ensure(get_test_name() + " invalid result", status == LSL_STATUS_BOUNDS_ERROR);
  354.         ensure(get_test_name() + " failed", empty == entry.getWhiteList());
  355.     }
  356.     template<> template<>
  357.     void object::test<11>()
  358.     {
  359.         set_test_name("Test to make sure both setWhiteList() functions behave the same");
  360.         
  361.         // Test a valid list
  362.         std::vector<std::string> whitelist, empty;
  363.         LLSD whitelist_llsd;
  364.         whitelist.push_back(std::string(URL_OK));
  365.         whitelist_llsd.append(std::string(URL_OK));
  366.         LLMediaEntry entry1, entry2;
  367.         ensure(get_test_name() + " setWhiteList(s) don't match",
  368.                entry1.setWhiteList(whitelist) == LSL_STATUS_OK &&
  369.                entry2.setWhiteList(whitelist_llsd)== LSL_STATUS_OK );
  370.         ensure(get_test_name() + " failed", 
  371.                entry1.getWhiteList() == entry2.getWhiteList());
  372.     }
  373.     
  374.     template<> template<>
  375.     void object::test<12>()
  376.     {
  377.         set_test_name("Test to make sure both setWhiteList() functions behave the same");
  378.         // Test an invalid list
  379.         std::vector<std::string> whitelist, empty;
  380.         LLSD whitelist_llsd;
  381.         whitelist.push_back(std::string(URL_OK));
  382.         whitelist.push_back(std::string(URL_TOO_BIG));
  383.         whitelist_llsd.append(std::string(URL_OK));
  384.         whitelist_llsd.append(std::string(URL_TOO_BIG));
  385.         LLMediaEntry entry1, entry2;
  386.         ensure(get_test_name() + " setWhiteList(s) don't match",
  387.                entry1.setWhiteList(whitelist) == LSL_STATUS_BOUNDS_ERROR &&
  388.                entry2.setWhiteList(whitelist_llsd) == LSL_STATUS_BOUNDS_ERROR);
  389.         ensure(get_test_name() + " failed", 
  390.                empty == entry1.getWhiteList() &&
  391.                empty == entry2.getWhiteList());
  392.     }
  393.     template<> template<>
  394.     void object::test<13>()
  395.     {
  396.         set_test_name("Test to make sure both setWhiteList() functions behave the same");
  397.         // Test an invalid list, too many
  398.         std::vector<std::string> whitelist, empty;
  399.         LLSD whitelist_llsd;
  400.         for (int i=0; i < LLMediaEntry::MAX_WHITELIST_SIZE+1; i++) {
  401.             whitelist.push_back("Q");
  402.             whitelist_llsd.append("Q");
  403.         }
  404.         LLMediaEntry entry1, entry2;
  405.         ensure(get_test_name() + " invalid result", 
  406.                entry1.setWhiteList(whitelist) == LSL_STATUS_BOUNDS_ERROR &&
  407.                entry2.setWhiteList(whitelist_llsd) == LSL_STATUS_BOUNDS_ERROR);
  408.         ensure(get_test_name() + " failed", 
  409.                empty == entry1.getWhiteList() &&
  410.                empty == entry2.getWhiteList());
  411.     }
  412.     
  413.     template<> template<>
  414.     void object::test<14>() 
  415. {
  416. // Whitelist check tests
  417. int n=0;
  418. // Check the "empty whitelist" case
  419. whitelist_test(++n, "", "http://www.example.com", true); 
  420. // Check the "missing scheme" case
  421. whitelist_test(++n, "www.example.com", "http://www.example.com", true);
  422. // Check the "exactly the same" case
  423. whitelist_test(++n, "http://example.com", "http://example.com", true);
  424. // Check the enable flag
  425. whitelist_test(++n, false, "www.example.com", "http://www.secondlife.com", true);
  426. whitelist_test(++n, true, "www.example.com", "http://www.secondlife.com", false);
  427. // Check permutations of trailing slash:
  428. whitelist_test(++n, "http://www.example.com", "http://www.example.com/", true);
  429. whitelist_test(++n, "http://www.example.com/", "http://www.example.com/", true);
  430. whitelist_test(++n, "http://www.example.com/", "http://www.example.com", false);
  431. whitelist_test(++n, "http://www.example.com", "http://www.example.com/foobar", true);
  432. whitelist_test(++n, "http://www.example.com/", "http://www.example.com/foobar", false);
  433.     
  434. // More cases...
  435. whitelist_test(++n, "http://example.com", "http://example.com/wiki", true);
  436. whitelist_test(++n, "www.example.com", "http://www.example.com/help", true);
  437. whitelist_test(++n, "http://www.example.com", "http://wwwexample.com", false);
  438. whitelist_test(++n, "http://www.example.com", "http://www.example.com/wiki", true);
  439. whitelist_test(++n, "example.com", "http://wwwexample.com", false);
  440. whitelist_test(++n, "http://www.example.com/", "http://www.amazon.com/wiki", false);
  441. whitelist_test(++n, "www.example.com", "http://www.amazon.com", false);
  442. // regexp cases
  443. whitelist_test(++n, "*.example.com", "http://www.example.com", true);
  444. whitelist_test(++n, "*.example.com", "http://www.amazon.com", false);
  445. whitelist_test(++n, "*.example.com", "http://www.example.com/foo/bar", true);
  446. whitelist_test(++n, "*.example.com", "http:/example.com/foo/bar", false);
  447. whitelist_test(++n, "*example.com", "http://example.com/foo/bar", true);
  448. whitelist_test(++n, "*example.com", "http://my.virus.com/foo/bar?example.com", false);
  449. whitelist_test(++n, "example.com", "http://my.virus.com/foo/bar?example.com", false);
  450. whitelist_test(++n, "*example.com", "http://my.virus.com/foo/bar?*example.com", false);
  451. whitelist_test(++n, "http://*example.com", "http://www.example.com", true);
  452. whitelist_test(++n, "http://*.example.com", "http://www.example.com", true);
  453. whitelist_test(++n, "http://*.e$?^.com", "http://www.e$?^.com", true);
  454. whitelist_test(++n, "*.example.com/foo/bar", "http://www.example.com/", false);
  455. whitelist_test(++n, "*.example.com/foo/bar", "http://example.com/foo/bar", false);
  456. whitelist_test(++n, "http://*.example.com/foo/bar", "http://www.example.com", false);
  457. whitelist_test(++n, "http://*.example.com", "https://www.example.com", false);
  458. whitelist_test(++n, "http*://*.example.com", "rtsp://www.example.com", false);
  459. whitelist_test(++n, "http*://*.example.com", "https://www.example.com", true);
  460. whitelist_test(++n, "example.com", "http://www.example.com", false);
  461. whitelist_test(++n, "www.example.com", "http://www.example.com:80", false);
  462. whitelist_test(++n, "www.example.com", "http://www.example.com", true);
  463. whitelist_test(++n, "www.example.com/", "http://www.example.com", false);
  464. whitelist_test(++n, "www.example.com/foo/bar/*", "http://www.example.com/foo/bar/baz", true);
  465.         // Path only
  466. whitelist_test(++n, "/foo/*/baz", "http://www.example.com/foo/bar/baz", true);
  467. whitelist_test(++n, "/foo/*/baz", "http://www.example.com/foo/bar/", false);
  468. }
  469. }