def test_content_missing_information():
    """Test that incomplete information in a content instruction fails."""

    err = ErrorBundle()
    c = ChromeManifest("content foo", "chrome.manifest")
    err.save_resource("chrome.manifest", c)
    tc_chromemanifest.test_content_instructions(err)
    assert err.failed()
def test_content_missing_information():
    """Test that incomplete information in a content instruction fails."""

    err = ErrorBundle()
    c = chrome_manifest('content foo')
    err.save_resource('chrome.manifest', c)
    tc_chromemanifest.test_content_instructions(err)
    assert err.failed()
def test_content_instructions():
    """Test that banned content namespaces are banned."""

    err = ErrorBundle()
    c = ChromeManifest("content foo bar", "chrome.manifest")
    err.save_resource("chrome.manifest", c)
    tc_chromemanifest.test_content_instructions(err)
    assert not err.failed()

    c = ChromeManifest("content godlikea bar", "chrome.manifest")
    err.save_resource("chrome.manifest", c)
    tc_chromemanifest.test_content_instructions(err)
    assert err.failed()
def test_content_instructions():
    """Test that banned content namespaces are banned."""

    err = ErrorBundle()
    c = chrome_manifest('content foo bar')
    err.save_resource('chrome.manifest', c)
    tc_chromemanifest.test_content_instructions(err)
    assert not err.failed()

    c = chrome_manifest('content godlikea bar')
    err.save_resource('chrome.manifest', c)
    tc_chromemanifest.test_content_instructions(err)
    assert err.failed()
def test_content_instructions_trailing_slash():
    """Test that trailing slashes are necessary for content instructions."""

    err = ErrorBundle()
    c = chrome_manifest('content namespace /uri/goes/here')
    err.save_resource('chrome.manifest', c)
    tc_chromemanifest.test_content_instructions(err)
    assert not err.failed()
    assert err.notices

    err = ErrorBundle()
    c = chrome_manifest('content namespace /uri/goes/here/ flag=true')
    err.save_resource('chrome.manifest', c)
    tc_chromemanifest.test_content_instructions(err)
    assert not err.failed()
    assert not err.notices
def test_content_instructions_trailing_slash():
    """Test that trailing slashes are necessary for content instructions."""

    err = ErrorBundle()
    c = chrome_manifest('content namespace /uri/goes/here')
    err.save_resource('chrome.manifest', c)
    tc_chromemanifest.test_content_instructions(err)
    assert not err.failed()
    assert err.notices

    err = ErrorBundle()
    c = chrome_manifest('content namespace /uri/goes/here/ flag=true')
    err.save_resource('chrome.manifest', c)
    tc_chromemanifest.test_content_instructions(err)
    assert not err.failed()
    assert not err.notices