New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 770436 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Oct 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Cleanup test_ui.py

Project Member Reported by pihsun@chromium.org, Sep 30 2017

Issue description

The py/test/test_ui.py have lots of unused and old functions, and many functions have implementation coupled with JavaScript side.

I think we should:
* Remove functions that are not used.
* Move most JavaScript part to goofy.js.
* Separate the parts that really depends on Chrome UI (RunJS, AppendHTML, ...) and the part that only deals with Goofy (PostEvent, URLForFile, ...)
 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1

commit 80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1
Author: Peter Shih <pihsun@chromium.org>
Date: Mon Oct 02 18:23:18 2017

test_ui: Cleanup unused functions.

* Remove GetUILanguage, and use the full locale string for all i18n
  related operations.
* Remove unused variables and functions.

BUG= chromium:770436 , chromium:678434 
TEST=make test
TEST=manually on DUT.

Change-Id: I93fe2d1a238123e8823e42da00a604eefbb0a311
Reviewed-on: https://chromium-review.googlesource.com/693721
Commit-Ready: Pi-Hsun Shih <pihsun@chromium.org>
Tested-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/ok.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/right-channel.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/test/pytests/audio_basic.py
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/2.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/test/pytests/audio.py
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/test/pytests/memory_size.py
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/8.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/2.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/test/pytests/lid_switch/lid_switch.py
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/6.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/left-channel.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/6.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/js/goofy.js
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/3.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/0.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/3.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/9.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/invocation.py
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/test/pytests/summary/summary.py
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/7.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/7.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/test/pytests/display.py
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/1.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/test/event.py
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/5.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/0.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/4.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/left-channel.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/8.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/1.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/po/zh-CN.po
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/en-US/ok.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/test/test_ui.py
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/4.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/test/e2e_test/e2e_test.py
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/right-channel.ogg
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/5.ogg
[modify] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/test/gooftools.py
[rename] https://crrev.com/80e85b0a9bfa6adbbe8128e0536cfa4fb44f72d1/py/goofy/static/sounds/zh-CN/9.ogg

Project Member

Comment 2 by bugdroid1@chromium.org, Oct 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/6dc9376c67d4f277799067451ae3c318f5f3e8e1

commit 6dc9376c67d4f277799067451ae3c318f5f3e8e1
Author: Peter Shih <pihsun@chromium.org>
Date: Mon Oct 02 18:23:18 2017

ui_templates: Cleanup.

Remove some unused variable and options.

BUG= chromium:770436 
TEST=make test

Change-Id: I25748bc8f50bb85d02d08bfb48ea386c6e88b756
Reviewed-on: https://chromium-review.googlesource.com/693842
Commit-Ready: Pi-Hsun Shih <pihsun@chromium.org>
Tested-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/6dc9376c67d4f277799067451ae3c318f5f3e8e1/py/test/ui_templates.py
[modify] https://crrev.com/6dc9376c67d4f277799067451ae3c318f5f3e8e1/py/test/pytests/update_device_data.py

Project Member

Comment 3 by bugdroid1@chromium.org, Oct 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/321c6575424d8f323c3736cd970ae148fdc28d55

commit 321c6575424d8f323c3736cd970ae148fdc28d55
Author: Peter Shih <pihsun@chromium.org>
Date: Fri Oct 06 13:26:19 2017

test_ui: Change MakePassFailKeyLabel to constants.

Since the usage of MakePassFailKeyLabel all have constant arguments, we
can simply change the MakePassFailKeyLabel function call to constant
variables of the labels to simplify the code.

BUG= chromium:770436 
TEST=make test

Change-Id: Ib52cf553a3756cea770a8dcb3a5da8536f1b940c
Reviewed-on: https://chromium-review.googlesource.com/704296
Commit-Ready: Pi-Hsun Shih <pihsun@chromium.org>
Tested-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/321c6575424d8f323c3736cd970ae148fdc28d55/py/test/pytests/audio.py
[modify] https://crrev.com/321c6575424d8f323c3736cd970ae148fdc28d55/py/test/pytests/line_check_item.py
[modify] https://crrev.com/321c6575424d8f323c3736cd970ae148fdc28d55/py/test/test_ui.py
[modify] https://crrev.com/321c6575424d8f323c3736cd970ae148fdc28d55/py/test/pytests/external_display.py
[modify] https://crrev.com/321c6575424d8f323c3736cd970ae148fdc28d55/py/test/pytests/keyboard_backlight.py
[modify] https://crrev.com/321c6575424d8f323c3736cd970ae148fdc28d55/py/test/pytests/model_sku.py

Project Member

Comment 4 by bugdroid1@chromium.org, Oct 11 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/0c7412044ba28426509426a5f77828dd6c649f40

commit 0c7412044ba28426509426a5f77828dd6c649f40
Author: Peter Shih <pihsun@chromium.org>
Date: Wed Oct 11 07:57:39 2017

goofy.js: Make CallJSFunction have correct 'this'.

Remove call_js_function event, and implement test_ui.CallJSFunction with
RunJS instead. This fix the limitation that it can only call top level
function (since calling member functions would have wrong 'this' value).

Also change some caller from RunJS to CallJSFunction.

BUG= chromium:770436 
TEST=make test

Change-Id: Ib6959cc49d2b86a2b9dbd620534f3f4cda4c011f
Reviewed-on: https://chromium-review.googlesource.com/704617
Commit-Ready: Pi-Hsun Shih <pihsun@chromium.org>
Tested-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/0c7412044ba28426509426a5f77828dd6c649f40/py/test/event.py
[modify] https://crrev.com/0c7412044ba28426509426a5f77828dd6c649f40/py/test/pytests/scan/scan.py
[modify] https://crrev.com/0c7412044ba28426509426a5f77828dd6c649f40/py/test/pytests/webgl_aquarium.py
[modify] https://crrev.com/0c7412044ba28426509426a5f77828dd6c649f40/py/test/test_ui.py
[modify] https://crrev.com/0c7412044ba28426509426a5f77828dd6c649f40/py/test/pytests/vswr/vswr.py
[modify] https://crrev.com/0c7412044ba28426509426a5f77828dd6c649f40/py/test/pytests/sync_factory_server.py
[modify] https://crrev.com/0c7412044ba28426509426a5f77828dd6c649f40/py/goofy/js/goofy.js

Project Member

Comment 5 by bugdroid1@chromium.org, Oct 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/58708768ec5ee5371e830669c3724dae1ca0c473

commit 58708768ec5ee5371e830669c3724dae1ca0c473
Author: Peter Shih <pihsun@chromium.org>
Date: Thu Oct 12 07:09:28 2017

test_ui: Remove SPINNER_HTML_16x16.

The variable is only used once and is not very useful, remove it and
remove the usage.

Also remove some unused CSS in start.py.

BUG= chromium:770436 
TEST=make test

Change-Id: I9b389444af96de1c5017a25fca91863cb0096486
Reviewed-on: https://chromium-review.googlesource.com/704297
Commit-Ready: Pi-Hsun Shih <pihsun@chromium.org>
Tested-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/58708768ec5ee5371e830669c3724dae1ca0c473/py/test/pytests/scan/scan.py
[modify] https://crrev.com/58708768ec5ee5371e830669c3724dae1ca0c473/py/test/test_ui.py
[modify] https://crrev.com/58708768ec5ee5371e830669c3724dae1ca0c473/py/test/pytests/start/start.py

Project Member

Comment 6 by bugdroid1@chromium.org, Oct 15 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0

commit d0235bba2a1a650d17ed9a2f7eba336bf256a7b0
Author: Peter Shih <pihsun@chromium.org>
Date: Fri Oct 13 21:45:06 2017

test_ui: Move key binding handling to JavaScript.

Move all handling for key bindings from test_ui.py to goofy.js, so it
is cleaner and can be reused by JavaScript codes.

Also change BindStandardKeys to BindStandardPassKeys and
BindStandardFailKeys, and change some test_ui RunJS from string
concatenation to use args.

BUG= chromium:770436 
TEST=make test
TEST=manually on DUT, run some pytests and see that the key handler and
     onscreen buttons both work.

Change-Id: Id77b763658413aa1ce580b8f4b19093baaee704b
Reviewed-on: https://chromium-review.googlesource.com/711816
Commit-Ready: Pi-Hsun Shih <pihsun@chromium.org>
Tested-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0/py/test/pytests/update_device_data.py
[modify] https://crrev.com/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0/po/zh-CN.po
[modify] https://crrev.com/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0/py/test/pytests/summary/summary.py
[modify] https://crrev.com/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0/py/test/pytests/pointing_device.py
[modify] https://crrev.com/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0/py/test/test_ui.py
[modify] https://crrev.com/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0/py/test/pytests/keyboard_backlight.py
[modify] https://crrev.com/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0/py/goofy/js/goofy.js
[modify] https://crrev.com/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0/py/test/pytests/camera.py
[modify] https://crrev.com/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0/py/test/test_task.py
[modify] https://crrev.com/d0235bba2a1a650d17ed9a2f7eba336bf256a7b0/py/test/pytests/message/message.py

Project Member

Comment 7 by bugdroid1@chromium.org, Oct 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/66e962831ef39155e09b46faf58f0fc0156763bd

commit 66e962831ef39155e09b46faf58f0fc0156763bd
Author: Peter Shih <pihsun@chromium.org>
Date: Wed Oct 18 06:14:22 2017

test_ui: Remove INIT_TEST_UI call from test_ui.

Remove the init_test_ui call from test_ui.py, so it's only called from
goofy.py when creating invocation now.

The default CSS files (test.css, i18n.css, goofy.css) are now set by
default_test_ui.html, and custom static HTML files of pytests only
override the body section of the page.

BUG= chromium:770436 
TEST=make test
TEST=manually on DUT.

Change-Id: I9a82b152166287b7618f533f7a23d0dd271c067f
Reviewed-on: https://chromium-review.googlesource.com/720716
Commit-Ready: Pi-Hsun Shih <pihsun@chromium.org>
Tested-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/66e962831ef39155e09b46faf58f0fc0156763bd/py/test/pytests/vswr/vswr.html
[modify] https://crrev.com/66e962831ef39155e09b46faf58f0fc0156763bd/py/test/pytests/audio_quality_static/audio_quality.html
[modify] https://crrev.com/66e962831ef39155e09b46faf58f0fc0156763bd/py/test/pytests/video_playback_static/video_playback.html
[modify] https://crrev.com/66e962831ef39155e09b46faf58f0fc0156763bd/py/test/test_ui.py
[modify] https://crrev.com/66e962831ef39155e09b46faf58f0fc0156763bd/py/test/pytests/audio_diagnostic_static/audio_diagnostic.html
[modify] https://crrev.com/66e962831ef39155e09b46faf58f0fc0156763bd/py/test/pytests/touchscreen_calibration/touchscreen_calibration.html
[modify] https://crrev.com/66e962831ef39155e09b46faf58f0fc0156763bd/py/test/pytests/audio_diagnostic_static/audio_diagnostic.js
[modify] https://crrev.com/66e962831ef39155e09b46faf58f0fc0156763bd/py/test/pytests/countdown_static/countdown.html
[modify] https://crrev.com/66e962831ef39155e09b46faf58f0fc0156763bd/py/goofy/js/goofy.js

Comment 8 by pihsun@chromium.org, Oct 31 2017

Status: Verified (was: Untriaged)

Sign in to add a comment