Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / server2 / cron_servlet_test.py
index 1f53263..dda11cb 100755 (executable)
@@ -13,6 +13,7 @@ from environment import GetAppVersion
 from extensions_paths import (
     APP_YAML, CONTENT_PROVIDERS, CHROME_EXTENSIONS, PUBLIC_TEMPLATES, SERVER2,
     STATIC_DOCS)
+from fake_fetchers import ConfigureFakeFetchers
 from gcs_file_system_provider import CloudStorageFileSystemProvider
 from github_file_system_provider import GithubFileSystemProvider
 from host_file_system_provider import HostFileSystemProvider
@@ -30,7 +31,7 @@ from test_util import EnableLogging, ReadFile
 class _TestDelegate(CronServlet.Delegate):
   def __init__(self, create_file_system):
     self.file_systems = []
-    # A callback taking a revision and returning a file system.
+    # A callback taking a commit and returning a file system.
     self._create_file_system = create_file_system
     self._app_version = GetAppVersion()
 
@@ -39,13 +40,13 @@ class _TestDelegate(CronServlet.Delegate):
 
   def CreateHostFileSystemProvider(self,
                                   object_store_creator,
-                                  max_trunk_revision=None):
-    def constructor(branch=None, revision=None):
-      file_system = self._create_file_system(revision)
+                                  pinned_commit=None):
+    def constructor(branch=None, commit=None):
+      file_system = self._create_file_system(commit)
       self.file_systems.append(file_system)
       return file_system
     return HostFileSystemProvider(object_store_creator,
-                                  max_trunk_revision=max_trunk_revision,
+                                  pinned_commit=pinned_commit,
                                   constructor_for_test=constructor)
 
   def CreateGithubFileSystemProvider(self, object_store_creator):
@@ -93,47 +94,64 @@ class CronServletTest(unittest.TestCase):
   @IgnoreMissingContentProviders
   def testSafeRevision(self):
     test_data = {
-      'api': {
-        '_api_features.json': '{}',
-        '_manifest_features.json': '{}',
-        '_permission_features.json': '{}',
+      'extensions': {
+        'browser': {
+          'api': {}
+        }
       },
-      'docs': {
-        'examples': {
-          'examples.txt': 'examples.txt contents'
-        },
-        'server2': {
-          'app.yaml': AppYamlHelper.GenerateAppYaml('2-0-8')
+      'chrome': {
+        'browser': {
+          'extensions': {
+            'OWNERS': '',
+            'api': {}
+          }
         },
-        'static': {
-          'static.txt': 'static.txt contents'
-        },
-        'templates': {
-          'articles': {
-            'activeTab.html': 'activeTab.html contents'
-          },
-          'intros': {
-            'browserAction.html': 'activeTab.html contents'
-          },
-          'private': {
-            'table_of_contents.html': 'table_of_contents.html contents',
-          },
-          'public': {
-            'apps': {
-              'storage.html': '<h1>storage.html</h1> contents'
-            },
-            'extensions': {
-              'storage.html': '<h1>storage.html</h1> contents'
+        'common': {
+          'extensions': {
+            'api': {
+              '_api_features.json': '{}',
+              '_manifest_features.json': '{}',
+              '_permission_features.json': '{}',
             },
-          },
-          'json': {
-            'chrome_sidenav.json': '{}',
-            'content_providers.json': ReadFile(CONTENT_PROVIDERS),
-            'manifest.json': '{}',
-            'permissions.json': '{}',
-            'strings.json': '{}',
-            'whats_new.json': '{}',
-          },
+            'docs': {
+              'examples': {
+                'examples.txt': 'examples.txt contents'
+              },
+              'server2': {
+                'app.yaml': AppYamlHelper.GenerateAppYaml('2-0-8')
+              },
+              'static': {
+                'static.txt': 'static.txt contents'
+              },
+              'templates': {
+                'articles': {
+                  'activeTab.html': 'activeTab.html contents'
+                },
+                'intros': {
+                  'browserAction.html': 'activeTab.html contents'
+                },
+                'private': {
+                  'table_of_contents.html': 'table_of_contents.html contents',
+                },
+                'public': {
+                  'apps': {
+                    'storage.html': '<h1>storage.html</h1> contents'
+                  },
+                  'extensions': {
+                    'storage.html': '<h1>storage.html</h1> contents'
+                  },
+                },
+                'json': {
+                  'chrome_sidenav.json': '{}',
+                  'content_providers.json': ReadFile(CONTENT_PROVIDERS),
+                  'manifest.json': '{}',
+                  'permissions.json': '{}',
+                  'strings.json': '{}',
+                  'whats_new.json': '{}',
+                },
+              }
+            }
+          }
         }
       }
     }
@@ -156,15 +174,14 @@ class CronServletTest(unittest.TestCase):
     storage_html_path = PUBLIC_TEMPLATES + 'apps/storage.html'
     static_txt_path = STATIC_DOCS + 'static.txt'
 
-    def create_file_system(revision=None):
-      '''Creates a MockFileSystem at |revision| by applying that many |updates|
+    def create_file_system(commit=None):
+      '''Creates a MockFileSystem at |commit| by applying that many |updates|
       to it.
       '''
-      mock_file_system = MockFileSystem(
-          TestFileSystem(test_data, relative_to=CHROME_EXTENSIONS))
-      updates_for_revision = (
-          updates if revision is None else updates[:int(revision)])
-      for update in updates_for_revision:
+      mock_file_system = MockFileSystem(TestFileSystem(test_data))
+      updates_for_commit = (
+          updates if commit is None else updates[:int(commit)])
+      for update in updates_for_commit:
         mock_file_system.Update(update)
       return mock_file_system