1 <!DOCTYPE html> 2 <!-- 3 Copyright 2015 The Chromium Authors. All rights reserved. 4 Use of this source code is governed by a BSD-style license that can be 5 found in the LICENSE file. 6 --> 7 8 <link rel="import" href="/dashboard/elements/test-picker.html"> 9 <link rel="import" href="/dashboard/static/testing_common.html"> 10 11 <link rel="import" href="/tracing/core/test_utils.html"> 12 13 <script> 14 'use strict'; 15 16 var MOCK_RESPONSE = { 17 'select-multiple-add': { 18 'has_rows': true, 19 'sub_tests': { 20 'select-multiple-add.html': { 21 'has_rows': true, 22 'sub_tests': {} 23 }, 24 'select-multiple-add.html_ref': { 25 'has_rows': true, 26 'sub_tests': { 27 } 28 }, 29 'ref': { 30 'has_rows': true, 31 'sub_tests': {} 32 } 33 } 34 }, 35 'textarea-edit': { 36 'has_rows': true, 37 'sub_tests': { 38 'textarea-edit.html_ref': { 39 'has_rows': true, 40 'sub_tests': {} 41 }, 42 'textarea-edit.html': { 43 'has_rows': true, 44 'sub_tests': {} 45 }, 46 'ref': { 47 'has_rows': true, 48 'sub_tests': {} 49 } 50 } 51 } 52 }; 53 54 tr.b.unittest.testSuite(function() { 55 56 var testOptions = { 57 setUp: function() { 58 }, 59 60 tearDown: function() { 61 // Must comment this out to do manual tests; tearDown gets called 62 // immediately after the test method finishes, and this is used to respond 63 // to user input which occurs far later. 64 testing_common.clearXhrMock(); 65 } 66 }; 67 68 test('instantiate', function() { 69 testing_common.addXhrMock('*', JSON.stringify(MOCK_RESPONSE)); 70 var testPicker = document.createElement('test-picker'); 71 testPicker.testSuites = { 72 'endure': { 73 'mas': {'Chromium': {'mac': false, 'win7': true}}, 74 'dep': true 75 }, 76 'dromaeo': { 77 'mas': {'Chromium': {'mac': false, 'win7': false}} 78 }, 79 'blink_perf': { 80 'mas': {'Chromium': {'mac': false, 'win7': false}}, 81 'mon': ['select-multiple-add/select-multiple-add.html'] 82 } 83 }; 84 this.addHTMLOutput(testPicker); 85 }, testOptions); 86 87 test('getSuiteItems', function() { 88 var testPicker = document.createElement('test-picker'); 89 testPicker.testSuites = { 90 'endure': { 91 'mas': {'Chromium': {'mac': false, 'win7': true}}, 92 'dep': true 93 }, 94 'dromaeo': { 95 'mas': {'Chromium': {'mac': false, 'win7': false}} 96 }, 97 'blink_perf': { 98 'mas': {'Chromium': {'mac': false, 'win7': false}}, 99 'mon': ['select-multiple-add/select-multiple-add.html'] 100 } 101 }; 102 var suiteItems = testPicker.getSuiteItems(); 103 // Test suites should be in the order of monitored, unmonitored, 104 // and deprecated. 105 var expectedSuites = ['blink_perf', 'dromaeo', 'endure']; 106 var actualSuites = []; 107 for (var i = 0; i < suiteItems.length; i++) { 108 actualSuites.push(suiteItems[i].name); 109 } 110 assert.deepEqual(actualSuites, expectedSuites); 111 }, testOptions); 112 113 }); 114 </script> 115