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.
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
= [
28 'additionsToExistingApis': [{
30 'type': 'additionsToExistingApis',
31 'id': 'backgroundpages.to-be-non-persistent',
32 'description': 'backgrounds to be non persistent'
38 'additionsToExistingApis': [{
40 'type': 'additionsToExistingApis',
41 'id': 'chromeSetting.set-regular-only-scope',
42 'description': 'ChromeSetting.set now has a regular_only scope.'
50 'type': 'manifestChanges',
51 'id': 'manifest-v1-deprecated',
52 'description': 'Manifest version 1 was deprecated in Chrome 18'
58 expected_new_info_of_apps
= [
62 'version': 26, 'type': 'apis',
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
= [
80 'version': 26, 'type': 'apis',
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__':