Commit Graph
40 Commits
Author SHA1 Message Date
Mario Sanchez Prada bbf5fd3fe9 Remove deprecated DISALLOW_ macros from Brave-specific code
Macros such as DISALLOW_COPY_AND_ASSIGN() are deprecated since r711900
per style arbitration [1]. This commit replaces the macros with deleted
constructors and methods, which is preferred by the Google C++ Style
Guide [2][3].

Also remove unneeded "base/macros.h" #includes when possible.

This CL is created semi-mechanically with remove_disallow and
remove_base_macros [4].

[1]: https://groups.google.com/a/chromium.org/g/cxx/c/qwH2hxaEjac/m/TUKq6eqfCwAJ
[2]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-dos-and-donts.md#explicitly-declare-class-copyability_movability
[3]: https://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types
[4]: https://pkg.go.dev/go.timothygu.me/tools/cr/cmd

Chromium change:

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

commit d002a3bee7ae75780b604d17df19291a3dd303fb
Author: Peter Boström <pbos@chromium.org>
Date:   Fri Nov 5 17:17:19 2021 +0000

    Remove DISALLOW_ macros from base/macros.h

    This removes DISALLOW_COPY(), DISALLOW_ASSIGN() and
    DISALLOW_COPY_AND_ASSIGN() from base/macros.h. PRESUBMITs are also
    updated to no longer check for these macros.

    IWYU removal is left as a separate change just in case this needs to be
    reverted.

    Bug: 1010217
2022-01-24 15:33:37 -05:00
Mario Sanchez Prada e5210e9389 Adapt unit test suite to removal of TestNetLog and its subclasses
Chromium changes:

https://chromium.googlesource.com/chromium/src/+/5ba07f7e15d9c0fce4c3e7f3a0d81b7e2d0e1ac1
https://chromium.googlesource.com/chromium/src/+/36a1fd69363120111a078f9b0e3d5458b9a6f461
https://chromium.googlesource.com/chromium/src/+/0049a0b7166118b686e736fd4a672ce0bb02e182

commit 5ba07f7e15d9c0fce4c3e7f3a0d81b7e2d0e1ac1
Author: Matt Reichhoff <mreichhoff@chromium.org>
Date:   Thu Oct 21 20:36:32 2021 +0000

    Remove TestNetLog and its subclasses

    This builds on the prior deletion of use of these classes.
    RecordingNetLogObserver remains in place and is used instead
    of the prior classes. Future cleanup will target NetLog pointers.

    Bug: 1052479

commit 36a1fd69363120111a078f9b0e3d5458b9a6f461
Author: Matt Reichhoff <mreichhoff@chromium.org>
Date:   Tue Oct 12 22:52:20 2021 +0000

    Remove direct use of RecordingTestNetLog

    This is the first of several commits to address
    test_net_log cleanup. Future commits will target
    RecordingBoundTestNetLog, full deletion of the
    classes, and removal of many NetLog pointers.

    Bug: 1052479

commit 0049a0b7166118b686e736fd4a672ce0bb02e182
Author: Matt Reichhoff <mreichhoff@chromium.org>
Date:   Wed Oct 20 20:44:26 2021 +0000

    Remove direct use of RecordingBoundTestNetLog

    This builds on the prior deletion of use of TestNetLog and
    RecordingTestNetLog. A future commit will delete the classes.

    Bug: 1052479
2021-12-07 14:45:18 -05:00
Mario Sanchez Prada a9d07ab525 Migrate "base::TimeDelta::FromX" to "base:X"
Chromium changes:

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

commit e5a38eddbdf45d7563a00d019debd11b803af1bb
Author: Peter Kasting <pkasting@chromium.org>
Date:   Sat Oct 2 03:06:35 2021 +0000

    Migrate "base::TimeDelta::FromX" to "base:X".

    All changes were done automatically with git grep, sed, xargs, etc.

    Bug: 1243777

https://source.chromium.org/chromium/chromium/src/+/7b54ffec9bcbc6658b7238f79a540e37cbaf352a

commit 7b54ffec9bcbc6658b7238f79a540e37cbaf352a
Author: Peter Kasting <pkasting@chromium.org>
Date:   Wed Oct 13 11:25:42 2021 +0000

    Remove deprecated TimeDelta functions.

    Bug: 1243777
2021-12-07 14:44:55 -05:00
Mario Sanchez Prada 8c8d366ef5 Migrate away from no longer existing ProxyServer::{FromURI,ToURI}
The correct replacements are:

  - ProxyServer::FromURI() -> net::ProxyUriToProxyServer()
  - ProxyServer::ToURI() -> net::ProxyServerToProxyUri()

Chromium change:

https://chromium.googlesource.com/chromium/src/+/5ccc3f0d4f3bb7d9b9caa93c266f3dbdfbf83205

commit 5ccc3f0d4f3bb7d9b9caa93c266f3dbdfbf83205
Author: Eric Orth <ericorth@chromium.org>
Date:   Thu Sep 23 00:01:57 2021 +0000

    Split ProxyServer PAC/URI conversion to a separate file

    No functional change.

    Helps simplify the ProxyServer class around its core purpose of
    representing proxy servers for net stack connections, which will
    make it easier to make upcoming refactors to both that and the
    separated-off conversion functionality.

    Bug: 1243398
2021-11-02 12:38:04 -04:00
mkarolin 5ba16856f7 Revert "Converted some unit tests source_set to static_library."
This reverts commit bb3b1f5ea0.
2021-07-01 09:32:38 -04:00
Max Karolinskiy bb3b1f5ea0 Converted some unit tests source_set to static_library. 2021-06-29 16:39:03 -04:00
mkarolin 0e7b362863 base::Optional -> absl::optional.
Chromium change:

https://source.chromium.org/chromium/chromium/src/+/2d59e682ab9eb904124f5778eb8ceb3cb2a90231

commit 2d59e682ab9eb904124f5778eb8ceb3cb2a90231
Author: Anton Bikineev <bikineev@chromium.org>
Date:   Tue May 18 12:29:22 2021 +0000

    Deprecate base/optional.h and fix remaining mentions.

    Docs are still to be updated (in a followup).

    Bug: 1202909

Converted remaining cases of base::Optional to absl::optional, plus
updated DEPS file with an exception that is temporarily required
while we don't have such exception added to Chromium's toplevel DEPS
file (see commit linked below, not yet included in 92.0.4503.5).

Chromium change:

https://source.chromium.org/chromium/chromium/src/+/9662571bb2954fb1759c49e5c45e59571cd1899e

commit 9662571bb2954fb1759c49e5c45e59571cd1899e
Author: Anton Bikineev <bikineev@chromium.org>
Date:   Thu May 13 19:17:50 2021 +0000

    Reland "Alias base::Optional to absl::optional"

    This relands f3493eb4f80c5716ed2d7de195f710537beacc6b. The reason of the
    failure: missing base// dep in some of the internal components, which
    caused the branded builds to fail.

    For sherrifs: the change may cause build failures on bots that are not
    tested in the regular CQ pipeline. Those issues are mostly caused by
    missing base// dependencies. Before reverting this change, please
    consider fixing missing dependencies, similar to what the CL 2891488
    does.

    Original CL description:
    > Alias base::Optional to absl::optional
    >
    > This CL does the following:
    > 1) Replaces base::Optional and friends with aliases to corresponding
    > entities from abseil. base::in_place is the only thing not aliased, as
    > it's also used in other contexts (e.g. StructPtr in mojo).
    > 2) Replaces all optional-related uses of base::in_place with
    > absl::in_place.
    > 3) Fixes missing headers (e.g. base/check.h) that used to be recursively
    > included from base/optional.h
    > 4) Also, removes forward declarations for base::Optional and instead
    > includes "base/optional.h" directly. The argument is the same as for
    > forward declarations of std types - the exact declaration (struct vs
    > class, number of template arguments (e.g. for SFINAE)) is an
    > implementation detail that can change.
    >
    > The CL also tries to support base/optional_unittest.cc (will be removed
    > with base/optional.h) however the nocompile is already removed, since
    > supporting it seems to be harder.
    >
    > Followup CLs will replace base::optional with absl::optional per
    > component.
    >
    > Bug: 1202909
    > Change-Id: I25b276401ceba13da35b3a0331d5ccbd338c4539
    > AX-Relnotes: n/a.
    > Reviewed-on:
    > https://chromium-review.googlesource.com/c/chromium/src/+/2892208
    > Commit-Queue: Anton Bikineev <bikineev@chromium.org>
    > Commit-Queue: Peter Kasting <pkasting@chromium.org>
    > Reviewed-by: Peter Kasting <pkasting@chromium.org>
    > Reviewed-by: Kentaro Hara <haraken@chromium.org>
    > Owners-Override: Peter Kasting <pkasting@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#882460}

    Bug: 1202909
2021-06-29 16:35:39 -04:00
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