Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(924)

Unified Diff: content/test/gpu/gpu_stress_tests/gpu_stress_unittest.py

Issue 11668013: Added GPU stress test with multiple tabs in one single window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated per Dave's comments. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/gpu/gpu_stress_tests/__init__.py ('k') | content/test/gpu/run_gpu_stress_tests » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/gpu/gpu_stress_tests/gpu_stress_unittest.py
diff --git a/content/test/gpu/gpu_stress_tests/gpu_stress_unittest.py b/content/test/gpu/gpu_stress_tests/gpu_stress_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..93f1ba1500c681b89dc4b944a18669d8435fd8f7
--- /dev/null
+++ b/content/test/gpu/gpu_stress_tests/gpu_stress_unittest.py
@@ -0,0 +1,64 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import random
+import unittest
+
+from telemetry.core import browser_finder
+from telemetry.test import options_for_unittests
+
+CUR_DIR = os.path.dirname(__file__)
+DATA_DIR = os.path.join(CUR_DIR, os.pardir, os.pardir, 'data', 'gpu')
+
+# Number of tabs to open for testing.
+NUM_TABS = 100
+
+
+class GpuValidationUnittest(unittest.TestCase):
+ """Verifies that GPU works properly under stress."""
+
+ def setUp(self):
+ """Gets the test assets and launches browser.
+
+ Test assets are html files from test data directory.
+ """
+
+ # Gets the test assets.
+ self._asset_list = []
+ for _, _, files in os.walk(DATA_DIR):
+ self._asset_list.extend([f for f in files if f.endswith('.html')])
+ self._num_assets = len(self._asset_list)
+
+ # Launches browser.
+ options = options_for_unittests.GetCopy()
+ browser_to_create = browser_finder.FindBrowser(options)
+ self._browser = browser_to_create.Create()
+ self._browser.SetHTTPServerDirectories([DATA_DIR])
+ self._tabs = self._browser.tabs
+
+ def tearDown(self):
+ self._browser.Close()
+
+ def testMultipleTabsInSingleWindow(self):
+ """Tests with multiple tabs opened in a single window."""
+
+ # Opens the tabs and navigates to the asset urls.
+ for i in xrange(NUM_TABS):
+ asset = self._asset_list[i % self._num_assets]
+ tab = self._tabs.New()
+ tab.Navigate(self._GetUrl(asset))
+
+ # Randomly cycles to the tabs.
+ tab_nums = range(1, NUM_TABS + 1)
+ random.shuffle(tab_nums)
+ for num in tab_nums:
+ self._tabs[num].Activate()
+
+ # Randomly closes the tabs.
+ while len(self._tabs) > 1:
+ self._tabs[random.randrange(1, len(self._tabs))].Close()
+
+ def _GetUrl(self, asset):
+ return self._browser.http_server.UrlOf(asset)
« no previous file with comments | « content/test/gpu/gpu_stress_tests/__init__.py ('k') | content/test/gpu/run_gpu_stress_tests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698