def test_minimal_manifest(self):
   """Tests correct web manifest for a minimal Chrome App manifest."""
   chrome_app_manifest = {
     'app': {
       'background': {
         'scripts': ['a_background_script.js']
       }
     },
     'manifest_version': 2,
     'name': 'Minimal App',
     'version': '1.0.0'
   }
   web_manifest = caterpillar.generate_web_manifest(chrome_app_manifest, '.')
   self.assertEqual(web_manifest['name'], 'Minimal App')
   self.assertEqual(web_manifest['short_name'], 'Minimal App')
   self.assertEqual(web_manifest['lang'], 'en')
   self.assertEqual(web_manifest['splash_screens'], [])
   self.assertEqual(web_manifest['display'], 'minimal-ui')
   self.assertEqual(web_manifest['orientation'], 'any')
   self.assertEqual(web_manifest['start_url'], '.')
   self.assertEqual(web_manifest['theme_color'], 'white')
   self.assertEqual(web_manifest['background_color'], 'white')
   self.assertEqual(web_manifest['related_applications'], [])
   self.assertEqual(web_manifest['prefer_related_applications'], False)
   self.assertEqual(web_manifest['icons'], [])
Exemple #2
0
 def test_minimal_manifest(self):
     """Tests correct web manifest for a minimal Chrome App manifest."""
     chrome_app_manifest = {
         'app': {
             'background': {
                 'scripts': ['a_background_script.js']
             }
         },
         'manifest_version': 2,
         'name': 'Minimal App',
         'version': '1.0.0'
     }
     web_manifest = caterpillar.generate_web_manifest(
         chrome_app_manifest, '.')
     self.assertEqual(web_manifest['name'], 'Minimal App')
     self.assertEqual(web_manifest['short_name'], 'Minimal App')
     self.assertEqual(web_manifest['lang'], 'en')
     self.assertEqual(web_manifest['splash_screens'], [])
     self.assertEqual(web_manifest['display'], 'minimal-ui')
     self.assertEqual(web_manifest['orientation'], 'any')
     self.assertEqual(web_manifest['start_url'], '.')
     self.assertEqual(web_manifest['theme_color'], 'white')
     self.assertEqual(web_manifest['background_color'], 'white')
     self.assertEqual(web_manifest['related_applications'], [])
     self.assertEqual(web_manifest['prefer_related_applications'], False)
     self.assertEqual(web_manifest['icons'], [])
  def test_complete_manifest(self):
    """Tests correct web manifest for a complete Chrome App manifest."""
    # Sample manifest taken from https://developer.chrome.com/apps/manifest,
    # with some elements removed and/or edited.
    chrome_app_manifest = {
      'app': {
        'background': {
          'scripts': ['a_background_script.js']
        }
      },
      'manifest_version': 2,
      'name': 'Minimal App',
      'version': '1.0.0',
      'default_locale': 'fr',
      'description': 'A plain text description',
      'icons': {
          '16': 'icon16.png',
          '128': 'icon128.png'
      },
      'author': 'anon',
      'bluetooth': {
        'uuids': ['110101', '2323']
      },
      'current_locale': 'de',
      'key': 'test34',
      'minimum_chrome_version': '1.0.0',
      'optional_permissions': ['tabs'],
      'permissions': ['tabs'],
      'platforms': ['windows'],
      'short_name': 'testapp3223',
      'version_name': '12.20.102',
      'webview': {
        "partitions": [
          {
            "name": "static",
            "accessible_resources": ["header.html", "footer.html", "static.png"]
          },
        ]
      }
    }

    web_manifest = caterpillar.generate_web_manifest(chrome_app_manifest, '.')
    self.assertEqual(web_manifest['name'], chrome_app_manifest['name'])
    self.assertEqual(
        web_manifest['short_name'], chrome_app_manifest['short_name'])
    self.assertEqual(
        web_manifest['lang'], chrome_app_manifest['default_locale'])
    self.assertEqual(web_manifest['splash_screens'], [])
    self.assertEqual(web_manifest['display'], 'minimal-ui')
    self.assertEqual(web_manifest['orientation'], 'any')
    self.assertEqual(web_manifest['start_url'], '.')
    self.assertEqual(web_manifest['theme_color'], 'white')
    self.assertEqual(web_manifest['background_color'], 'white')
    self.assertEqual(web_manifest['related_applications'], [])
    self.assertEqual(web_manifest['prefer_related_applications'], False)
    self.assertItemsEqual(web_manifest['icons'], [{
      'src': 'icon128.png',
      'sizes': '128x128'
    }, {
      'src': 'icon16.png',
      'sizes': '16x16'
    }])
Exemple #4
0
    def test_complete_manifest(self):
        """Tests correct web manifest for a complete Chrome App manifest."""
        # Sample manifest taken from https://developer.chrome.com/apps/manifest,
        # with some elements removed and/or edited.
        chrome_app_manifest = {
            'app': {
                'background': {
                    'scripts': ['a_background_script.js']
                }
            },
            'manifest_version': 2,
            'name': 'Minimal App',
            'version': '1.0.0',
            'default_locale': 'fr',
            'description': 'A plain text description',
            'icons': {
                '16': 'icon16.png',
                '128': 'icon128.png'
            },
            'author': 'anon',
            'bluetooth': {
                'uuids': ['110101', '2323']
            },
            'current_locale': 'de',
            'key': 'test34',
            'minimum_chrome_version': '1.0.0',
            'optional_permissions': ['tabs'],
            'permissions': ['tabs'],
            'platforms': ['windows'],
            'short_name': 'testapp3223',
            'version_name': '12.20.102',
            'webview': {
                "partitions": [
                    {
                        "name":
                        "static",
                        "accessible_resources":
                        ["header.html", "footer.html", "static.png"]
                    },
                ]
            }
        }

        web_manifest = caterpillar.generate_web_manifest(
            chrome_app_manifest, '.')
        self.assertEqual(web_manifest['name'], chrome_app_manifest['name'])
        self.assertEqual(web_manifest['short_name'],
                         chrome_app_manifest['short_name'])
        self.assertEqual(web_manifest['lang'],
                         chrome_app_manifest['default_locale'])
        self.assertEqual(web_manifest['splash_screens'], [])
        self.assertEqual(web_manifest['display'], 'minimal-ui')
        self.assertEqual(web_manifest['orientation'], 'any')
        self.assertEqual(web_manifest['start_url'], '.')
        self.assertEqual(web_manifest['theme_color'], 'white')
        self.assertEqual(web_manifest['background_color'], 'white')
        self.assertEqual(web_manifest['related_applications'], [])
        self.assertEqual(web_manifest['prefer_related_applications'], False)
        self.assertItemsEqual(web_manifest['icons'], [{
            'src': 'icon128.png',
            'sizes': '128x128'
        }, {
            'src': 'icon16.png',
            'sizes': '16x16'
        }])