def test_usages_added(self): """Tests that usages are added to the API info.""" apis = {'power': MANIFEST_POWER, 'app.runtime': MANIFEST_RUNTIME} usage = chrome_app.apis.usage(apis, MINIMAL_APP_DIR) report.process_usage(apis, usage) self.assertEqual( apis['power']['usage'], [('m\xfd other script.js', 1, '// keep awakes\n' '<span class="ca-feature none">' 'chrome.power.requestKeepAwake</span>();\n' '// the user is now awake\nnotAChromeAppCall();\n', 0)]) self.assertEqual( apis['app.runtime']['usage'], [('my scr\xedpt.js', 0, '<span class="ca-feature none">' 'chrome.app.runtime.onLaunched.addListener</span>(function() {\n' ' chrome.app.window.create(\'my \xedndex.html\');\n});\n', 0)])
def test_usages_added(self): """Tests that usages are added to the API info.""" apis = { 'power': MANIFEST_POWER, 'app.runtime': MANIFEST_RUNTIME } usage = chrome_app.apis.usage(apis, MINIMAL_APP_DIR) report.process_usage(apis, usage) self.assertEqual(apis['power']['usage'], [('m\xfd other script.js', 1, '// keep awakes\n' '<span class="ca-feature none">' 'chrome.power.requestKeepAwake</span>();\n' '// the user is now awake\nnotAChromeAppCall();\n', 0)]) self.assertEqual(apis['app.runtime']['usage'], [('my scr\xedpt.js', 0, '<span class="ca-feature none">' 'chrome.app.runtime.onLaunched.addListener</span>(function() {\n' ' chrome.app.window.create(\'my \xedndex.html\');\n});\n', 0)])
def test_no_apis(self): """Tests that if there are no APIs, then nothing changes.""" apis = {} report.process_usage(apis, MINIMAL_APP_DIR) self.assertEqual(apis, {})