Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / whats_new_data_source_test.py
blob9e015eee2b3af1a3c9e260dd1b55bf53c37a2901
1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 import json
7 import os
8 import unittest
9 import sys
11 from extensions_paths import EXTENSIONS
12 from fake_host_file_system_provider import FakeHostFileSystemProvider
13 from server_instance import ServerInstance
14 from test_data.canned_data import CANNED_API_FILE_SYSTEM_DATA
15 from whats_new_data_source import WhatsNewDataSource
18 class WhatsNewDataSourceTest(unittest.TestCase):
19 def testCreateWhatsNewDataSource(self):
20 api_fs_creator = FakeHostFileSystemProvider(CANNED_API_FILE_SYSTEM_DATA)
21 server_instance = ServerInstance.ForTest(
22 file_system_provider=api_fs_creator)
24 whats_new_data_source = WhatsNewDataSource(server_instance, None)
25 expected_whats_new_changes_list = [
27 'version': 22,
28 'additionsToExistingApis': [{
29 'version': 22,
30 'type': 'additionsToExistingApis',
31 'id': 'backgroundpages.to-be-non-persistent',
32 'description': 'backgrounds to be non persistent'
37 'version': 21,
38 'additionsToExistingApis': [{
39 'version': 21,
40 'type': 'additionsToExistingApis',
41 'id': 'chromeSetting.set-regular-only-scope',
42 'description': 'ChromeSetting.set now has a regular_only scope.'
47 'version': 20,
48 'manifestChanges': [{
49 'version': 20,
50 'type': 'manifestChanges',
51 'id': 'manifest-v1-deprecated',
52 'description': 'Manifest version 1 was deprecated in Chrome 18'
58 expected_new_info_of_apps = [
60 'version': 26,
61 'apis': [{
62 'version': 26, 'type': 'apis',
63 'name': u'alarm',
64 'description': u'<code>alarm</code>'
67 'version': 26, 'type': 'apis',
68 'name': u'app.window',
69 'description': u'<code>app.window</code>'
74 expected_new_info_of_apps.extend(expected_whats_new_changes_list)
76 expected_new_info_of_extensions = [
78 'version': 26,
79 'apis': [{
80 'version': 26, 'type': 'apis',
81 'name': u'alarm',
82 'description': u'<code>alarm</code>'
85 'version': 26, 'type': 'apis',
86 'name': u'browserAction',
87 'description': u'<code>browserAction</code>'
92 expected_new_info_of_extensions.extend(expected_whats_new_changes_list)
94 whats_new_for_apps = whats_new_data_source.get('apps')
95 whats_new_for_extension = whats_new_data_source.get('extensions')
96 self.assertEqual(expected_new_info_of_apps, whats_new_for_apps)
97 self.assertEqual(expected_new_info_of_extensions, whats_new_for_extension)
99 if __name__ == '__main__':
100 unittest.main()