-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Mac ARM (Apple Silicon) support
This patch aims to close the issue #421 by doing the following: 1. Only including the `--disable-gpu` flag when running on Windows as it is not needed on other platforms and it causes issues on Mac ARM. 2. Adding the `--use-angle=metal` flag when running on Mac ARM so the browser uses the Metal API instead of OpenGL. Close #421
- Loading branch information
Showing
3 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
|
||
describe Ferrum::Browser::Options::Chrome do | ||
def reload_chrome_class | ||
described_class.constants(false).each do |const| | ||
described_class.send(:remove_const, const) | ||
end | ||
load 'ferrum/browser/options/chrome.rb' | ||
end | ||
|
||
describe "DEFAULT_OPTIONS" do | ||
it "includes `disable-gpu` flag only on windows" do | ||
allow(Ferrum::Utils::Platform).to receive(:windows?).and_return(true) | ||
reload_chrome_class | ||
expect(described_class::DEFAULT_OPTIONS).to include("disable-gpu" => nil) | ||
|
||
allow(Ferrum::Utils::Platform).to receive(:windows?).and_return(false) | ||
reload_chrome_class | ||
expect(described_class::DEFAULT_OPTIONS).not_to include("disable-gpu" => nil) | ||
|
||
allow(Ferrum::Utils::Platform).to receive(:windows?).and_call_original | ||
reload_chrome_class | ||
end | ||
|
||
it "includes `use-angle=metal` flag only on mac arm" do | ||
allow(Ferrum::Utils::Platform).to receive(:mac_arm?).and_return(true) | ||
reload_chrome_class | ||
expect(described_class::DEFAULT_OPTIONS).to include("use-angle" => "metal") | ||
|
||
allow(Ferrum::Utils::Platform).to receive(:mac_arm?).and_return(false) | ||
reload_chrome_class | ||
expect(described_class::DEFAULT_OPTIONS).not_to include("use-angle" => "metal") | ||
|
||
allow(Ferrum::Utils::Platform).to receive(:mac_arm?).and_call_original | ||
reload_chrome_class | ||
end | ||
end | ||
end |