Commit Graph
33 Commits
Author SHA1 Message Date
mkarolin 65f483898f Removed an unnecessary DCHECK in ProxyConfigServiceTor. 2021-02-04 23:52:55 -05:00
mkarolin 9c68ad9b8c Do not use NetworkIsolationKey c'tor that takes Origins.
This c'tor is getting deprecated. See https://crbug.com/1145294.

Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/4807a9ac25ec2b53f5e24750b67010817748a8f7

commit 4807a9ac25ec2b53f5e24750b67010817748a8f7
Author: Matt Menke <mmenke@chromium.org>
Date:   Sat Nov 21 00:14:41 2020 +0000

    Remove calls to NetworkIsolationKey's old constructor in net/.

    Instead, use the shiny new one that takes net::SchemefulSites instead of
    url::Origins.

    Bug: 1145294
2021-02-04 23:52:46 -05:00
mkarolin a642c7a191 NetworkIsolationKey now uses SchemefulSite.
Chromium change:

https://source.chromium.org/chromium/chromium/src/+/f8d36fdf0115eebcdc0d1e2cc57093f19fa595f7

commit f8d36fdf0115eebcdc0d1e2cc57093f19fa595f7
Author: Matt Menke <mmenke@chromium.org>
Date:   Fri Nov 20 03:56:13 2020 +0000

    Make NetworkIsolationKey use SchemefulSite.

    There's still a constructor that takes Origins that needs to be removed,
    once consumers are migrated.

    Bug: 1145294
2021-02-04 23:52:15 -05:00
mkarolin e7d6fd5e92 Rename usage of GetTopFrameOrigin() to GetTopFrameSite() II.
Removed NIK method we added (GetEffectiveTopFrameOrigin) because
Chromium's own GetTopFrameSite performs the same functionality.

Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/e6e4f399a1c124f7aef06cce915dcb87d3a7facf

commit e6e4f399a1c124f7aef06cce915dcb87d3a7facf
Author: Matt Menke <mmenke@chromium.org>
Date:   Thu Oct 8 11:41:29 2020 +0000

    Remove original origin fields from NetworkIsolationKey.

    They're mostly not being used, since IsolationInfo now mirrors those
    fields.

    While the fields in IsolationInfo still have one issue the fields in
    NetworkIsolationKey had (namely, they may be site instead of origin,
    for requests created from a NetworkIsolationKey), this does resolve one
    of the issues with the field: NetworkIsolationKeys are used as keys,
    and having two NIKs that are logically equal buy observably different
    is a potential source of bugs.

    Bug: None
2020-12-08 15:26:52 -05:00
Mario Sanchez Prada 9c11a1fc8b 7955: Adapt PCSTor::CircuitIsolationKey to using net::NetworkIsolationKey
This patch changes ProxyConfigServiceTor::CircuitIsolationKey() to rely
on upstream's net::NetworkIsolationKey() instead of implementing pretty
much the same logic manually.

Note that net::NetworkIsolationKey() does not provide a way to retrieve
its internal |top_frame_origin_|, which stores the origin/etld+1 of the
original top frame passed on constructions, which is what we need for
the CircuitIsolationKey according to the Tor design specs. For this
reason, this patch also provide a chromium_src override for the file
//net/base/network_isolation_key.h that adds an extra helper for that.
2020-11-20 11:31:47 +01:00
Anthony Tseng b03d2c44db Fix tests 2020-11-18 15:13:22 -08:00
Anthony Tseng 4e658bdccb Move tor related tests out of test/BUILD.gn
and fix minor deps issues
2020-10-27 16:27:23 -07:00
Anthony Tseng f3d6aba836 Cleanup: lint, DCHECK, VLOG 2020-09-17 15:05:45 -07:00
Anthony Tseng 44042fa307 Apply auto selected port from tor
Remove kTorProxyString without migration is becasue it was always default value
2020-09-17 15:05:38 -07:00
mkarolin 937fd77b16 [Unit tests] ConfiguredProxyResolutionService ctor change.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/3be01ba90cc361969ccee64a0d735587de84f7a3

commit 3be01ba90cc361969ccee64a0d735587de84f7a3
Author: Eric Roman <eroman@chromium.org>
Date:   Fri Apr 3 21:37:09 2020 +0000

    Reland "Add quick check parameter to ConfiguredProxyResolutionService ctor"

    This reverts commit 89fd75a0105852eae12909a1a82d7add4f269c1e.

    Original change's description:
    > Add quick check parameter to ConfiguredProxyResolutionService ctor
    >
    > Doing this cleans up an undesirable ConfiguredProxyResolutionService
    > usage pattern where code that primarily works with a
    > ProxyResolutionService must currently cast to the specialized class
    > before setting the right PAC quick check value.
    >
    > Bug: 1032820
2020-07-01 18:12:02 -04:00
mkarolin 148aeeca05 [Unit tests] ConfiguredProxyResolutionService::Request moved.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/9d383314fa8cbde76f36e5f9b138cd8a844f956c

commit 9d383314fa8cbde76f36e5f9b138cd8a844f956c
Author: Nicolas Arciniega <niarci@microsoft.com>
Date:   Tue Feb 18 23:36:41 2020 +0000

    Refactor ConfiguredProxyResolutionService::Request

    This change moves out ConfiguredProxyResolutionService::Request into its
    own file and renames it to ProxyResolutionRequest. This will be
    necessary later on when we create a second version of the
    ConfiguredProxyResolutionService under a base ProxyResolutionService
    that relies completely on system APIs. In that second version, we will
    also want to track the status of a proxy resolution request.

    This change is intended to introduce zero functional changes. It is a
    pure refactor change.

    Bug: 1032820
2020-05-26 09:52:30 -04:00
mkarolin 22688b4082 ProxyResolutionService -> ConfiguredProxyResolutionService.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/d2013f9668d0587b1042572dadc6bd2e772d3248

commit d2013f9668d0587b1042572dadc6bd2e772d3248
Author: Nicolas Arciniega <niarci@microsoft.com>
Date:   Fri Feb 7 23:00:56 2020 +0000

    Rename ProxyResolutionService to ConfiguredProxyResolutionService

    This change is the first step in creating a proxy resolver that
    completely relies on the underlying system to figure out a proxy. The
    ProxyResolutionService is currently deeply tied to the notion of first
    fetching proxy configurations (ex: a PAC URL) and then using those
    configurations to resolve a proxy. Since a proxy resolver that truly
    defers to the underlying operating system for all proxy logic does not
    follow this model, it is helpful if we separate the generic
    ProxyResolutionService from the notion of configurations.

    This change renames the existing ProxyResolutionService, which relies
    on fetching proxy configurations, to ConfiguredProxyResolutionService.
    The only other changes to this file are suggestions from presubmit and
    Tricium.

    A set of future CLs will break up the ConfiguredProxyResolutionService
    into the logical pieces needed to create a new, generic
    ProxyResolutionService that does not necessarily depend on configs.

    This change is intended to introduce zero functional changes. It is a
    pure refactor change.

    Bug: 1032820
2020-05-26 09:52:27 -04:00
mkarolin 274763dd32 [Unit tests] ResolveProxy signature change.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/8045afd1e3fea6a92af66d8d1db34133edbb2b09

commit 8045afd1e3fea6a92af66d8d1db34133edbb2b09
Author: Matt Menke <mmenke@chromium.org>
Date:   Thu Nov 14 20:31:19 2019 +0000

    NetworkIsolationKeys + PAC scripts PS6: ProxyResolver

    Make the ProxyService API take a NetworkIsolationKey and pass it down to
    the ProxyResolver. Also make the main consumer actually pass in
    requests' NIK.

    Some other callsites still need to be updated to pass in NIKs.

    Also introduce new pattern of using NetworkIsolationKey::Todo() to
    create empty NetworkIsolationKeys() in places that should be modified
    to pass in populated NetworkIsolationKeys.

    Bug: 1021661
2020-01-29 07:43:56 -05:00
mkarolin 0c4a8a50a4 [Unit tests] BoundTestNetLog -> RecordingBoundTestNetLog.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/d9342e3aba7f0370cad34c498c2108f93e12dc33

commit d9342e3aba7f0370cad34c498c2108f93e12dc33
Author: Matt Mueller <mattm@chromium.org>
Date:   Tue Nov 26 01:41:14 2019 +0000

    Rename TestNetLog->RecordingTestNetLog and BoundTestNetLog->RecordingBoundTestNetLog

    These names are more descriptive and also free up the name TestNetLog
    for use in a future CL.

    Bug: 177538
2020-01-29 07:43:56 -05:00
mkarolin 88748e91ff TestBrowserThreadBundle was removed.
Along with a few other test classes, see below.

Chromium change:

https://chromium.googlesource.com/chromium/src/+/2dfa2ba40a372f4a08ba0d051b5cbe5accf2c526

commit 2dfa2ba40a372f4a08ba0d051b5cbe5accf2c526
Author: Gabriel Charette <gab@chromium.org>
Date:   Tue Sep 10 00:28:54 2019 +0000

    [TaskEnvironment] Remove old types

    Explicitly (to document for git log purposes), this removes:
      - base::test::ScopedTaskEnvironment
      - net::WithScopedTaskEnvironment
      - net::TestWithScopedTaskEnvironment
      - content::TestBrowserThreadBundle
      - web::TestWebThreadBundle

    Mass migrate stragglers which landed under old names after initial
    mass migration.

    TBR=dcheng@chromium.org
    (to bypass owners for mechanical changes outside //base)

    Bug: 992483
2019-11-27 15:57:48 -05:00
mkarolin e0f109c3d6 Unit tests: header files were renamed.
base/test/scoped_task_environment.h -> base/test/task_environment.h
content/public/test/test_browser_thread_bundle.h -> content/public/test/browser_task_environment.h
net/test/test_with_scoped_task_environment.h -> net/test/test_with_task_environment.h

Chromium change:

https://chromium.googlesource.com/chromium/src/+/c7108748948a6ab308f323d6e72c59d29c7e240a

commit c7108748948a6ab308f323d6e72c59d29c7e240a
Author: Gabriel Charette <gab@chromium.org>
Date:   Fri Aug 23 03:31:40 2019 +0000

    Reland "[TaskEnvironment] Complete migration with header rename"

    This is a reland of 18947083c7e75ec6d5e8c3b729515d83bde41c59

    The move_source_file.py script's formatting rules incorrectly
    formatted services/device/generic_sensor/platform_sensor_and_provider_unittest_win.cc
    after all. But we also can't rely 100% on git cl format (crbug.com/997063)
    so I ended up performing a git cl format && git add -up
    (+interactive addition of missing blank line after foo.h when included
    from top of foo.cc)

    Also added
    $ tools/git/move_source_file.py net/test/test_with_scoped_task_environment.h net/test/test_with_task_environment.h

    Original change's description:
    > [TaskEnvironment] Complete migration with header rename
    >
    > This is merely:
    >
    > $ tools/git/move_source_file.py base/test/scoped_task_environment.h base/test/task_environment.h
    > $ tools/git/move_source_file.py base/test/scoped_task_environment.cc base/test/task_environment.cc
    > $ tools/git/move_source_file.py base/test/scoped_task_environment_unittest.cc base/test/task_environment_unittest.cc
    > $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.h content/public/test/browser_task_environment.h
    > $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle.cc content/public/test/browser_task_environment.cc
    > $ tools/git/move_source_file.py content/public/test/test_browser_thread_bundle_unittest.cc content/public/test/browser_task_environment_unittest.cc
    > $ tools/git/move_source_file.py ios/web/public/test/test_web_thread_bundle.h ios/web/public/test/web_task_environment.h
    > $ tools/git/move_source_file.py ios/web/test/test_web_thread_bundle.cc ios/web/test/web_task_environment.cc
    >
    > and a few manual renames in DEPS files missed by the script
    >
    > This CL uses --bypass-hooks to avoid having to git cl format because
    > many headers are being reordered by git cl format and it's too many to
    > figure out in a no-op CL which ones are okay with it.
    > windows.h for one should typically be first and another one of the
    > reorderings in PS3 even caused a compile failure:
    > https://chromium-review.googlesource.com/c/chromium/src/+/1764962/3/components/services/font/font_loader_unittest.cc
    >
    > TBR=dcheng@chromium.org
    >
    > Bug: 992483
2019-10-10 02:53:23 -04:00
Anthony Tseng 014d4802f1 Add test for ProxyConfigMonitor 2019-07-05 16:39:36 -07:00
bridiver 2e0e6a5684 reenable tests 2019-07-02 18:05:12 -07:00
bridiver 92e0556bbf don't try to parse a uri into a HostPortPair 2019-07-01 19:20:26 -07:00
bridiver c97b162866 temporarily disable tor proxy unit tests 2019-07-01 15:51:40 -07:00
bridiver c66331be3b fix lint issues 2019-07-01 14:30:48 -07:00
bridiver 96a540627e use TimeDelta milliseconds representation 2019-07-01 14:21:04 -07:00
bridiver 0c61c9f5eb CircuitIsolationKey and IsTorProxy no longer need to be public 2019-07-01 14:02:03 -07:00
bridiver ea95fe1065 cleanup from review comments 2019-07-01 13:55:19 -07:00
bridiver b6cd3d227e cleanup the tor proxy map 2019-06-28 11:40:27 -07:00
bridiver a7ee76c3de use proxy config to reset tor circuit 2019-06-26 18:52:40 -07:00
bridiver 68e12b8230 cleanup patch and fix potential concurrency issue with tor_circuit_callback_ 2019-06-25 13:26:03 -07:00
bridiver 327ec7c361 initial patch cleanup 2019-06-24 14:33:26 -07:00
Anthony Tseng 1201169654 Address review comments from @iefremov 2019-06-24 09:54:57 -07:00
Anthony Tseng 85392db699 Use ProxyServer for proxy uri parsing ProxyConfigServiceTor
And address misc review comments
2019-06-24 09:54:57 -07:00
Anthony Tseng 2a4ab7decc Apply clang-format 2019-06-24 09:54:57 -07:00
Anthony Tseng ad06ddb2a9 Fix/Add test for tor 2019-06-24 09:54:57 -07:00
Anthony Tseng d7db72e9d6 NetworkService migration for Tor
When NetworkService is enabled, we only have access to profile-wise
proxy config. So we discard proxy config per url request path to have a
global proxy config for tor profile and insert username/password when it
is about to resolve proxy in net::ProxyResolutionService.

Note
1. new flow works no matter NetworkService enabled or not.
2. ProxyConfigServiceTor has to be NET exported to avoid //net circular
  dependency.
3. ProxyConfigMonitor chromium overrides is for setting profile-wise
  proxy config without setting proxy_config::prefs::kProxy which will be
  interfered by other components(ex. DataReductionProxyService)
2019-06-24 09:54:57 -07:00