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

Issue 804292 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 801578



Sign in to add a comment

Migrate cros browser.Create to use Telemetry's new APIs

Project Member Reported by perezju@chromium.org, Jan 22 2018

Issue description

In the following files:

- src/components/proximity_auth/e2e_test/cros.py
- autotest/files/client/common_lib/cros/chrome.py

Instead of

- possible_browser.Create(finder_options)

The new API to create & use browser is:

- possible_browser.SetUpEnvironment(browser_options)
- possible_browser.Create()  # No longer receives any options
- possible_browser.CleanUpEnvironment()

Or:

with possible_browser.BrowserSession(browser_options) as browser:
   # Do something with the browser.

(see detail in  issue 801578 )

+achuith could you please help me with these?

 
Blocking: 801578
Cc: -perezju@chromium.org achuith@chromium.org
Owner: perezju@chromium.org
Juan, I'm having quite a bit of trouble using the new API.

The previous flow in chrome.py was this:
1. finder_options = browser_options.BrowserFinderOptions()
2. set finder_options and browser_options related to command line flags.
3. finder_options.CreateParser()
4. browser_options = finder_options.browser_options
5. set browser_options
6. browser_to_create = browser_finder.FindBrowser(finder_options)
7. browser = browser_to_create.Create(finder_options)

Replacing browser_to_create.Create(finder_options) with browser_to_create.BrowserSession(browser_options) doesn't work.

I've tried a few other permutations that didn't work either, but honestly I just don't understand enough about what's happening here to fix this.

On your VM, the file chrome.py is at:
/usr/local/autotest/common_lib/cros/chrome.py

You can log in to the VM, modify this file, and run /usr/local/autotest/bin/vm_sanity.py, and if the test passes, your changes are probably good.

If you get stuck for any reason, I can dig deeper into this but it'll probably take me some time to get up to speed on your changes.
Yes, BrowserSession must be called in a with-statement otherwise it won't work. For your case, since you open/close the browser from different methods, you need to explicitly SetUpEnvironment before calling Create, and then CleanUpEnvironment after Close.

Attaching a patch I tested on the VM as you suggested.
chrome.py.diff
1005 bytes Download
Actually, it might be a good idea to take out the "SetUpEnvironment" out of the retry-loop, similar to what I've done here:
https://chromium-review.googlesource.com/c/chromium/src/+/881142
Status: Started (was: Assigned)
Thanks for the diff! Let me know if this looks ok to you. I verified it locally and it's currently running on trybots:
https://chromium-review.googlesource.com/881308
Project Member

Comment 6 by bugdroid1@chromium.org, Jan 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/autotest/+/5a12e4d3bfb30a47009afc7fdcf6d3c6fcd698c2

commit 5a12e4d3bfb30a47009afc7fdcf6d3c6fcd698c2
Author: Achuith Bhandarkar <achuith@chromium.org>
Date: Thu Jan 25 04:30:39 2018

[chrome]: Migrate browser.Create to new api

BUG= chromium:804292 
TEST=vm_sanity.py, bots

Change-Id: If34a42ec90d469d07bcd34e015abf8699c8f8c7d
Reviewed-on: https://chromium-review.googlesource.com/881308
Commit-Ready: Achuith Bhandarkar <achuith@chromium.org>
Tested-by: Achuith Bhandarkar <achuith@chromium.org>
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Reviewed-by: Juan Antonio Navarro Pérez <perezju@chromium.org>

[modify] https://crrev.com/5a12e4d3bfb30a47009afc7fdcf6d3c6fcd698c2/client/common_lib/cros/chrome.py

Status: Fixed (was: Started)
Should be fixed
Cc: tengs@chromium.org tbarzic@chromium.org
Status: Started (was: Fixed)
We're still missing:

- src/components/proximity_auth/e2e_test/cros.py

To be migrated here:
https://chromium-review.googlesource.com/c/chromium/src/+/881142
Project Member

Comment 9 by bugdroid1@chromium.org, Jan 29 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5983e37f9c214ac0c248738ffc0c5cd2b82a3490

commit 5983e37f9c214ac0c248738ffc0c5cd2b82a3490
Author: Juan Antonio Navarro Perez <perezju@google.com>
Date: Mon Jan 29 09:37:57 2018

[Telemetry refactor] Migrate proximity_auth client to new browser API

- Add explicit calls to SetUp-/CleanUpEnvironment.

TBR=tengs@chromium.org

Bug:  804292 , 801578 
Change-Id: I54d0925b308867020ed69b4330abd529beb61d77
Reviewed-on: https://chromium-review.googlesource.com/881142
Reviewed-by: Juan Antonio Navarro Pérez <perezju@chromium.org>
Commit-Queue: Juan Antonio Navarro Pérez <perezju@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532372}
[modify] https://crrev.com/5983e37f9c214ac0c248738ffc0c5cd2b82a3490/components/proximity_auth/e2e_test/cros.py

Status: Fixed (was: Started)
Finished now.
Project Member

Comment 11 by bugdroid1@chromium.org, Feb 6 2018

Labels: merge-merged-release-R65-10323.B
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/autotest/+/a134cca3ce3a859dd63281250bb0915adfc0690a

commit a134cca3ce3a859dd63281250bb0915adfc0690a
Author: Achuith Bhandarkar <achuith@chromium.org>
Date: Tue Feb 06 18:13:17 2018

[chrome]: Migrate browser.Create to new api

BUG= chromium:804292 
TEST=vm_sanity.py, bots

Change-Id: If34a42ec90d469d07bcd34e015abf8699c8f8c7d
Reviewed-on: https://chromium-review.googlesource.com/881308
Commit-Ready: Achuith Bhandarkar <achuith@chromium.org>
Tested-by: Achuith Bhandarkar <achuith@chromium.org>
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Reviewed-by: Juan Antonio Navarro Pérez <perezju@chromium.org>
(cherry picked from commit 5a12e4d3bfb30a47009afc7fdcf6d3c6fcd698c2)
Reviewed-on: https://chromium-review.googlesource.com/904944
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Commit-Queue: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>

[modify] https://crrev.com/a134cca3ce3a859dd63281250bb0915adfc0690a/client/common_lib/cros/chrome.py

Sign in to add a comment