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

Unified Diff: chrome/test/data/webui/settings/open_section_transition_browsertest.js

Issue 2106013002: Move settings-section animations into setting-section, make better (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Transitions
Patch Set: cleanup Created 4 years, 6 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
Index: chrome/test/data/webui/settings/open_section_transition_browsertest.js
diff --git a/chrome/test/data/webui/settings/open_section_transition_browsertest.js b/chrome/test/data/webui/settings/open_section_transition_browsertest.js
new file mode 100644
index 0000000000000000000000000000000000000000..751e1a6e6b9cba2e26991d404970c076b228b53e
--- /dev/null
+++ b/chrome/test/data/webui/settings/open_section_transition_browsertest.js
@@ -0,0 +1,103 @@
+// Copyright 2016 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.
+
+/**
+ * @fileoverview Tests for settings.OpenSectionTransition and
+ * settings.CloseSectionTransition.
+ */
+
+/** @const {string} Path to root from chrome/test/data/webui/settings/. */
+var ROOT_PATH = '../../../../../';
+
+// Polymer BrowserTest fixture.
+GEN_INCLUDE(
+ [ROOT_PATH + 'chrome/test/data/webui/polymer_browser_test_base.js']);
+
+/**
+ * @constructor
+ * @extends PolymerTest
+*/
+function SettingsOpenSectionTransitionBrowserTest() {}
+
+SettingsOpenSectionTransitionBrowserTest.prototype = {
+ __proto__: PolymerTest.prototype,
+
+ /** @override */
+ browsePreload:
+ 'chrome://md-settings/settings_page/open_section_transition.html',
+
+ /** @override */
+ extraLibraries: PolymerTest.getLibraries(ROOT_PATH),
+
+ /** @override */
+ isAsync: true,
+
+ /** @override */
+ runAccessibilityChecks: false,
+};
+
+TEST_F('SettingsOpenSectionTransitionBrowserTest', 'OpenSectionTransition',
+ function() {
+ suite('settings.animation.OpenSectionTransition', function() {
+ var container;
+ var section;
+ var card;
+
+ suiteSetup(function() {
+ return PolymerTest.importHtml('/settings_page/settings_section.html');
+ });
+
+ setup(function() {
+ container = document.createElement('div');
+ container.style.height = '1000px';
+ container.style.height = '800px';
+ section = document.createElement('settings-section');
+ section.style.height = '300px';
+ card = section.$.card;
+ container.appendChild(section);
+ document.body.appendChild(container);
+
+ // Simulate content and setup.
+ card.style.top = '10px';
+ card.style.height = '200px';
+ card.origHeight_ = card.clientHeight;
+ });
+
+ teardown(function() {
+ container.remove();
+ });
+
+ test('transition finishes', function() {
+ settings.animation.Timing.DURATION = 200;
+ var openTransition =
+ new settings.OpenSectionTransition(section, container);
+ var startTime = performance.now();
+ var finished = openTransition.play();
+ expectEquals('fixed', getComputedStyle(card).position);
+ return finished.then(function() {
+ // Ensure the animation actually played over a length of time.
+ // TODO(michaelpg): Verify this is not flaky.
+ var totalTime = performance.now() - startTime;
+ expectLE(settings.animation.Timing.DURATION, totalTime);
+ expectEquals('', card.style.position);
+
dschuyler 2016/06/30 01:24:04 extra blank line.
michaelpg 2016/07/07 05:27:43 Done.
+
+ var closeTransition =
+ new settings.CloseSectionTransition(section, container);
+ closeTransition.setUp();
+ startTime = performance.now();
+ finished = closeTransition.play();
+ return finished.then(function() {
+ totalTime = performance.now() - startTime;
+ expectLE(settings.animation.Timing.DURATION, totalTime);
+ expectEquals('static', getComputedStyle(card).position);
+ });
+ });
+ });
+ // TODO(michaelpg): More tests.
+ });
+
+ // Run all registered tests.
+ mocha.run();
+});

Powered by Google App Engine
This is Rietveld 408576698