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 fake_host_file_system_provider
import FakeHostFileSystemProvider
12 from server_instance
import ServerInstance
13 from test_data
.canned_data
import CANNED_API_FILE_SYSTEM_DATA
14 from whats_new_data_source
import WhatsNewDataSource
17 class WhatsNewDataSourceTest(unittest
.TestCase
):
18 def testCreateWhatsNewDataSource(self
):
19 api_fs_creator
= FakeHostFileSystemProvider(CANNED_API_FILE_SYSTEM_DATA
)
20 server_instance
= ServerInstance
.ForTest(
21 file_system_provider
=api_fs_creator
)
23 whats_new_data_source
= WhatsNewDataSource(server_instance
, None)
24 expected_whats_new_changes_list
= [
27 'additionsToExistingApis': [{
29 'type': 'additionsToExistingApis',
30 'id': 'backgroundpages.to-be-non-persistent',
31 'description': 'backgrounds to be non persistent'
37 'additionsToExistingApis': [{
39 'type': 'additionsToExistingApis',
40 'id': 'chromeSetting.set-regular-only-scope',
41 'description': 'ChromeSetting.set now has a regular_only scope.'
49 'type': 'manifestChanges',
50 'id': 'manifest-v1-deprecated',
51 'description': 'Manifest version 1 was deprecated in Chrome 18'
57 expected_new_info_of_apps
= [
61 'version': 26, 'type': 'apis',
63 'description': u
'<code>alarm</code>'
66 'version': 26, 'type': 'apis',
67 'name': u
'app.window',
68 'description': u
'<code>app.window</code>'
73 expected_new_info_of_apps
.extend(expected_whats_new_changes_list
)
75 expected_new_info_of_extensions
= [
79 'version': 26, 'type': 'apis',
81 'description': u
'<code>alarm</code>'
84 'version': 26, 'type': 'apis',
85 'name': u
'browserAction',
86 'description': u
'<code>browserAction</code>'
91 expected_new_info_of_extensions
.extend(expected_whats_new_changes_list
)
93 whats_new_for_apps
= whats_new_data_source
.get('apps')
94 whats_new_for_extension
= whats_new_data_source
.get('extensions')
95 self
.assertEqual(expected_new_info_of_apps
, whats_new_for_apps
)
96 self
.assertEqual(expected_new_info_of_extensions
, whats_new_for_extension
)
98 if __name__
== '__main__':