| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from telemetry.page import page as page_module | 5 from telemetry.page import page as page_module |
| 6 from telemetry.page import legacy_page_test | 6 from telemetry.page import legacy_page_test |
| 7 from telemetry import story | 7 from telemetry import story |
| 8 | 8 |
| 9 | 9 |
| 10 NUM_BLOB_MASS_CREATE_READS = 15 | 10 NUM_BLOB_MASS_CREATE_READS = 15 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 def RunPageInteractions(self, action_runner): | 22 def RunPageInteractions(self, action_runner): |
| 23 action_runner.ExecuteJavaScript('disableUI = true;') | 23 action_runner.ExecuteJavaScript('disableUI = true;') |
| 24 | 24 |
| 25 for size_bytes in self._blob_sizes: | 25 for size_bytes in self._blob_sizes: |
| 26 with action_runner.CreateInteraction('Action_CreateAndReadBlob', | 26 with action_runner.CreateInteraction('Action_CreateAndReadBlob', |
| 27 repeatable=True): | 27 repeatable=True): |
| 28 # TODO(catapult:#3028): Fix interpolation of JavaScript values. | 28 # TODO(catapult:#3028): Fix interpolation of JavaScript values. |
| 29 action_runner.ExecuteJavaScript( | 29 action_runner.ExecuteJavaScript( |
| 30 'createAndRead(' + str(size_bytes) + ');') | 30 'createAndRead(' + str(size_bytes) + ');') |
| 31 action_runner.WaitForJavaScriptCondition( | 31 action_runner.WaitForJavaScriptCondition( |
| 32 'doneReading === true || errors', 60) | 32 'doneReading === true || errors', timeout_in_seconds=60) |
| 33 | 33 |
| 34 errors = action_runner.EvaluateJavaScript('errors') | 34 errors = action_runner.EvaluateJavaScript('errors') |
| 35 if errors: | 35 if errors: |
| 36 raise legacy_page_test.Failure('Errors on page: ' + ', '.join(errors)) | 36 raise legacy_page_test.Failure('Errors on page: ' + ', '.join(errors)) |
| 37 | 37 |
| 38 | 38 |
| 39 class BlobMassCreate(page_module.Page): | 39 class BlobMassCreate(page_module.Page): |
| 40 def __init__(self, write_method, blob_sizes, page_set): | 40 def __init__(self, write_method, blob_sizes, page_set): |
| 41 super(BlobMassCreate, self).__init__( | 41 super(BlobMassCreate, self).__init__( |
| 42 url='file://blob/blob-workshop.html', | 42 url='file://blob/blob-workshop.html', |
| (...skipping 10 matching lines...) Expand all Loading... |
| 53 repeatable=True): | 53 repeatable=True): |
| 54 # TODO(catapult:#3028): Fix interpolation of JavaScript values. | 54 # TODO(catapult:#3028): Fix interpolation of JavaScript values. |
| 55 action_runner.ExecuteJavaScript('createBlob(' + str(size_bytes) + ');') | 55 action_runner.ExecuteJavaScript('createBlob(' + str(size_bytes) + ');') |
| 56 | 56 |
| 57 # Read blobs | 57 # Read blobs |
| 58 for _ in range(0, NUM_BLOB_MASS_CREATE_READS): | 58 for _ in range(0, NUM_BLOB_MASS_CREATE_READS): |
| 59 with action_runner.CreateInteraction('Action_ReadBlobs', | 59 with action_runner.CreateInteraction('Action_ReadBlobs', |
| 60 repeatable=True): | 60 repeatable=True): |
| 61 action_runner.ExecuteJavaScript('readBlobsSerially();') | 61 action_runner.ExecuteJavaScript('readBlobsSerially();') |
| 62 action_runner.WaitForJavaScriptCondition( | 62 action_runner.WaitForJavaScriptCondition( |
| 63 'doneReading === true || errors', 60) | 63 'doneReading === true || errors', timeout_in_seconds=60) |
| 64 # Clean up blobs. Make sure this flag is turned on: | 64 # Clean up blobs. Make sure this flag is turned on: |
| 65 # --enable-experimental-web-platform-features | 65 # --enable-experimental-web-platform-features |
| 66 action_runner.ExecuteJavaScript('garbageCollect();') | 66 action_runner.ExecuteJavaScript('garbageCollect();') |
| 67 | 67 |
| 68 errors = action_runner.EvaluateJavaScript('errors') | 68 errors = action_runner.EvaluateJavaScript('errors') |
| 69 if errors: | 69 if errors: |
| 70 raise legacy_page_test.Failure('Errors on page: ' + ', '.join(errors)) | 70 raise legacy_page_test.Failure('Errors on page: ' + ', '.join(errors)) |
| 71 | 71 |
| 72 | 72 |
| 73 class BlobWorkshopPageSet(story.StorySet): | 73 class BlobWorkshopPageSet(story.StorySet): |
| (...skipping 17 matching lines...) Expand all Loading... |
| 91 | 91 |
| 92 self.AddStory(BlobCreateThenRead('2Bx200', [2] * 200, self)) | 92 self.AddStory(BlobCreateThenRead('2Bx200', [2] * 200, self)) |
| 93 self.AddStory(BlobCreateThenRead('1KBx200', [1024] * 200, self)) | 93 self.AddStory(BlobCreateThenRead('1KBx200', [1024] * 200, self)) |
| 94 self.AddStory( | 94 self.AddStory( |
| 95 BlobCreateThenRead('150KBx200', [150 * 1024 - 1] * 200, self)) | 95 BlobCreateThenRead('150KBx200', [150 * 1024 - 1] * 200, self)) |
| 96 self.AddStory(BlobCreateThenRead('1MBx200', [1024 * 1024] * 200, self)) | 96 self.AddStory(BlobCreateThenRead('1MBx200', [1024 * 1024] * 200, self)) |
| 97 self.AddStory( | 97 self.AddStory( |
| 98 BlobCreateThenRead('10MBx30', [10 * 1024 * 1024] * 30, self)) | 98 BlobCreateThenRead('10MBx30', [10 * 1024 * 1024] * 30, self)) |
| 99 self.AddStory( | 99 self.AddStory( |
| 100 BlobCreateThenRead('80MBx5', [80 * 1024 * 1024] * 5, self)) | 100 BlobCreateThenRead('80MBx5', [80 * 1024 * 1024] * 5, self)) |
| OLD | NEW |