Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build of upstream Chromium's unit_tests & browser_tests targets #7899

Merged
merged 1 commit into from
Mar 6, 2021

Conversation

mariospr
Copy link
Contributor

@mariospr mariospr commented Feb 9, 2021

Three build failures are currently preventing us from building these
unit_tests & browser_test binaries from upstream:

  1. A compilation error due to FakeDeviceInfoTracker not implementing
    Brave-specific's GetAllBraveDeviceInfo() and DeleteDeviceInfo()
    virtual methods from DeviceInfoTracker (added via an override).

  2. A compilation error in //c/b/apps/guest_view/web_view_browsertest.cc
    because of testing code using RenderViewContextMenu's static method
    RegisterMenuShownCallbackForTesting(), which would expect a callback
    |base::OnceCallback<void(RenderViewContextMenu_Chromium*>| because
    of the source override in chromium_src/c/b/renderer_context_menu, but
    a |base::OnceCallback<void(BraveRenderViewContextMenu*)>| will be
    passed instead due to the redefinition set in that source override.

  3. A linking error due to push_messaging_service_unittest.cc requiring
    a dependency for BraveTestingProfile (also added via an override).

This patches fixes all those three errors via chromium overrides and
a small patch to //chrome/test/BUILD.gn to add a missing dependency.

Fix brave/brave-browser#14001

Resolves brave/brave-browser#14001

Submitter Checklist:

  • There is a ticket for my issue.
  • Used Github auto-closing keywords in the commit message.
  • Wrote a good PR/commit description
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed).
  • Requested a security/privacy review as needed.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

N/A

@mariospr mariospr requested a review from a team as a code owner February 9, 2021 18:52
@mariospr
Copy link
Contributor Author

mariospr commented Feb 9, 2021

@bridiver and/or @mkarolin PTAL to this small PR to enable building the unit_tests binary, so that we can resume work on brave/brave-browser#8376. Thanks!

@mariospr
Copy link
Contributor Author

FWIW, the failure in the linux CI bot is unrelated to this change (i.e. a pre-existing issue on master):

[2021-02-12T18:46:24.554Z] 1 test failed:
[2021-02-12T18:46:24.554Z]     BraveShieldsAPIBrowserTest.AllowScriptsOnceIframe (../../brave/browser/extensions/api/brave_shields_api_browsertest.cc:185)

@mariospr
Copy link
Contributor Author

@bridiver @iefremov Pinging you on this again, thanks!

Note: this patch is a dependency of both brave/brave-browser#8376 and brave/brave-browser#8297

"//ui/web_dialogs:web_dialogs_unittests",
"//v8",
]
+ deps += [ "//brave/test:brave_test_support_unit", ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to fix a linking error that happens because of the push_messaging_service_unittest.cc having a dependency on BraveTestingProfile (via a chromium_src override) that needs to be satisfied.

Without this bit, the following error happens at link time:

ld.lld: error: undefined symbol: BraveTestingProfile::BraveTestingProfile()
>>> referenced by push_messaging_service_unittest.cc:73 (/home/mario/work/brave-browser/src/brave/chromium_src/chrome/browser/push_messaging/../../../../../chrome/browser/push_messaging/push_messaging_service_unittest.cc:73)
>>>               obj/chrome/test/unit_tests/push_messaging_service_unittest.o:((anonymous namespace)::PushMessagingTestingProfile::PushMessagingTestingProfile())
>>> did you mean: BraveTestingProfile::~BraveTestingProfile()
>>> defined in: obj/chrome/test/unit_tests/push_messaging_service_unittest.o

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe it's best to insert brave_testing_profile into the testing_profile .h/.cc through chromium_src overrides and then they'll be available here without any patches

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize I could do that, thanks for the suggestion.

PR updated!

@mariospr mariospr force-pushed the issues/14001 branch 4 times, most recently from 39c9f51 to 34824cc Compare March 4, 2021 18:48
Three build failures are currently preventing us from building these
unit_tests & browser_test binaries from upstream:

1. A compilation error due to FakeDeviceInfoTracker not implementing
   Brave-specific's GetAllBraveDeviceInfo() and DeleteDeviceInfo()
   virtual methods from DeviceInfoTracker (added via an override).

2. A compilation error in //c/b/apps/guest_view/web_view_browsertest.cc
   because of testing code using RenderViewContextMenu's static method
   RegisterMenuShownCallbackForTesting(), which would expect a callback
   |base::OnceCallback<void(RenderViewContextMenu_Chromium*>| because
   of the source override in chromium_src/c/b/renderer_context_menu, but
   a |base::OnceCallback<void(BraveRenderViewContextMenu*)>| will be
   passed instead due to the redefinition set in that source override.

3. A linking error due to push_messaging_service_unittest.cc requiring
   a dependency for BraveTestingProfile (also added via an override).

This patches fixes all those three errors via chromium overrides.

Fix brave/brave-browser#14001
@mariospr mariospr merged commit b682590 into master Mar 6, 2021
@mariospr mariospr deleted the issues/14001 branch March 6, 2021 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to compile Chromium's unit_tests & browser_tests targets
2 participants