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

Issue 891952 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Oct 9
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug
Proj-Servicification

Blocking:
issue 827532



Sign in to add a comment

Migrate net::URLRequestMockHTTPJob related tests to work with Network Service

Project Member Reported by chongz@chromium.org, Oct 4

Issue description

The following tests rely on |net::URLRequestMockHTTPJob| and |chrome_browser_net::SetUrlRequestMocksEnabled()| to force install extensions:
-AffiliationCheck/EnterpriseDeviceAttributesTest.Success/*
-CheckSystemTokenAvailability/EnterprisePlatformKeysTest.Basic/*
-SigninProfileAppsPolicyPerChannelTest.*
-SigninProfileAppsPolicyTest.*

However the 'update_manifest.xml'[1] contains hard-coded URL (e.g. 'http://mock.http/extensions/api_test/enterprise_device_attributes.crx') and doesn't work with Network Service.

Possible solutions:
1. Use |URLLoaderInterceptor| to point 'mock.http' requests to |embedded_test_server()|.
2. Use |EmbeddedTestServer::RegisterRequestHandler()| to serve 'update_manifest.xml' requests dynamically, and replace hard-coded URL with |embedded_test_server()|'s host.

[1] https://cs.chromium.org/chromium/src/chrome/test/data/extensions/api_test/enterprise_device_attributes/update_manifest.xml

 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 9

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

commit b646779ebda19f55c60fc6854cc457ceb11bfd6d
Author: Chong Zhang <chongz@chromium.org>
Date: Tue Oct 09 01:51:57 2018

NetworkService: Migrate net::URLRequestMockHTTPJob related tests for Chrome OS

This patch migrated 23 tests by utilizing
|EmbeddedTestServer::RegisterRequestHandler()| to modify the response
"update_manifest.xml" (replace "mock.http" with "127.0.0.1:<port>") to make
the tests work with Network Service.

Notes:
1. We need this because |net::URLRequestMockHTTPJob| doesn't work with
   Network Service.
2. Host resolver doesn't work here because the "update_manifest.xml" files
   don't know the correct port number.

See Bug for alternative solutions.

Bug:  891952 
Change-Id: Ifb5de73678e8811b00599dbc530e68edecf1cd8a
Reviewed-on: https://chromium-review.googlesource.com/c/1260484
Commit-Queue: Chong Zhang <chongz@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597773}
[modify] https://crrev.com/b646779ebda19f55c60fc6854cc457ceb11bfd6d/chrome/browser/chromeos/policy/signin_profile_apps_policy_browsertest.cc
[modify] https://crrev.com/b646779ebda19f55c60fc6854cc457ceb11bfd6d/chrome/browser/extensions/api/enterprise_device_attributes/enterprise_device_attributes_apitest.cc
[modify] https://crrev.com/b646779ebda19f55c60fc6854cc457ceb11bfd6d/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_apitest_nss.cc
[modify] https://crrev.com/b646779ebda19f55c60fc6854cc457ceb11bfd6d/chrome/test/data/extensions/api_test/enterprise_device_attributes/update_manifest.xml
[modify] https://crrev.com/b646779ebda19f55c60fc6854cc457ceb11bfd6d/chrome/test/data/extensions/api_test/enterprise_platform_keys/update_manifest.xml
[modify] https://crrev.com/b646779ebda19f55c60fc6854cc457ceb11bfd6d/chrome/test/data/extensions/signin_screen_manual_test_app/update_manifest.xml
[modify] https://crrev.com/b646779ebda19f55c60fc6854cc457ceb11bfd6d/chrome/test/data/extensions/trivial_extension/update_manifest.xml
[modify] https://crrev.com/b646779ebda19f55c60fc6854cc457ceb11bfd6d/chrome/test/data/extensions/trivial_platform_app/update_manifest.xml
[modify] https://crrev.com/b646779ebda19f55c60fc6854cc457ceb11bfd6d/testing/buildbot/filters/mojo.fyi.chromeos.network_browser_tests.filter

Labels: M-71
Status: Fixed (was: Started)

Sign in to add a comment