Chrome For Mac Source Code



Learn how to Get Around the Chromium Source Code Directory Structure. For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.

  • WebDriver is an open source tool for automated testing of webapps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more. ChromeDriver is a standalone server that implements the W3C WebDriver standard. ChromeDriver is available for Chrome on Android and Chrome on Desktop (Mac.
  • Because Google has used parts from Apple's Safari and Mozilla's Firefox browsers, they made the project open source. Google Chrome for Mac is widely popular because it offers Google-specific features on your Mac. Download Google Chrome on your Mac to get a multi-functional web browser that’s easy to use and customize, no matter your skill level.
  • Setup ChromeDriver is a Chromium project and the code lives in the Chromium repo. Chromium is the open source project which Google Chrome is based on. Follow the instructions for checking out the entire chromium source tree. After you have your source checkout, make sure you have completed all the build prerequisites for your platform.
Have a voice in guiding the future of Google's developer brands. Share your thoughts in our survey.

Your job doesn't end with ensuring your site runs great across Chrome and Android. Even though Device Mode can simulate a range of other devices like iPhones, we encourage you to check out other browsers solutions for emulation.

TL;DR

  • When you don’t have a particular device, or want to do a spot check on something, the best option is to emulate the device right inside your browser.
  • Device emulators and simulators let you mimic your development site on a range of devices from your workstation.
  • Cloud-based emulators let you automate unit tests for your site across different platforms.

Browser emulators

Browser emulators are great for testing a site's responsiveness, but they don’temulate differences in API, CSS support, and certain behaviors that you'd seeon a mobile browser. Test your site on browsers running on real devices to becertain everything behaves as expected.

Firefox' Responsive Design View

Firefox has a responsive design viewthat encourages you to stop thinking in terms of specific devices and insteadexplore how your design changes at common screen sizes or your own size bydragging the edges.

Edge's F12 Emulation

To emulate Windows Phones, use Microsoft Edge's built-in emulation.

Since Edge does not ship with legacy compatibility, use IE 11's Emulation to simulate how your page would look in older versions of Internet Explorer.

Device emulators and simulators

Device simulators and emulators simulate not just the browser environment but the entire device. They're useful to test things that require OS integration, for example form input with virtual keyboards.

Android Emulator

At the moment, there is no way to install Chrome on an Android emulator. However, you can use the Android Browser, the Chromium Content Shell and Firefox for Android which we'll cover later in this guide. Chromium Content Shell uses the same Chrome rendering engine, but comes without any of the browser specific features.

The Android emulator comes with the Android SDK which you need to download fromhere. Then follow the instructions to setup a virtual device and start the emulator.

Once your emulator is booted, click on the Browser icon and you'll be able to test your site on the old Stock Browser for Android.

Chromium Content Shell on Android

To install the Chromium Content Shell for Android, leave your emulator runningand run the following commands at a command prompt:

Now you can test your site with the Chromium Content Shell.

Firefox on Android

Similar to Chromium's Content Shell, you can get an APK to install Firefox onto the emulator.

Download the right .apk file from https://ftp.mozilla.org/pub/mozilla.org/mobile/releases/latest/.

Chrome For Mac Source Code

From here, you can install the file onto an open emulator or connected Android device with the following command:

iOS Simulator

The iOS simulator for Mac OS X comes with Xcode, which you can install from theApp Store.

When you're done, learn how to work with the simulator through Apple's documentation.

Note: To avoid having to open Xcode every time you want to use the iOS Simulator, open it, then right click the iOS Simulator icon in your dock and select Keep in Dock. Now just click this icon whenever you need it.

Modern.IE

Modern.IE Virtual Machines let you access different versions of IE on your computer via VirtualBox (or VMWare). Choose a virtual machine on the download page here.

Cloud-based emulators and simulators

If you can’t use the emulators and don't have access to real devices, then cloud-based emulators are the next best thing. A big advantage of cloud-based emulators over real devices and local emulators is that you can automate unit tests for your site across different platforms.

  • BrowserStack (commercial) is the easiest to use for manual testing. You select an operating system, select your browser version and device type, select a URL to browse, and it spins up a hosted virtual machine that you can interact with. You can also fire up multiple emulators in the same screen, letting you test how your app looks and feels across multiple devices at the same time.
  • SauceLabs (commercial) allows you to run unit tests inside of an emulator, which can be really useful for scripting a flow through your site and watch the video recording of this afterwards on various devices. You can also do manual testing with your site.
  • Device Anywhere (commercial) doesn'tuse emulators but real devices which you can control remotely. This is very useful in the event where you need to reproduce a problem on a specific device and can't see the bug on any of the options in the previous guides.

Feedback

Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.
Thank you for the feedback. If you have specific ideas on how to improve this page, please create an issue.

There are instructions for other platforms linked from the get the code page.

Instructions for Google Employees

Are you a Google employee? See go/building-chrome instead.

System requirements

Chrome Source Code Lines

  • A 64-bit Mac running 10.14+.

  • Xcode 11.2+

  • The OS X 10.15.1 SDK. Run

    to check whether you have it. Building with a newer SDK works too, but the releases currently use Xcode 11.2.1.

Install depot_tools

Clone the depot_tools repository:

Add depot_tools to the end of your PATH (you will probably want to put this in your ~/.bash_profile or ~/.zshrc). Assuming you cloned depot_tools to /path/to/depot_tools (note: you must use the absolute path or Python will not be able to find infra tools):

Get the code

Ensure that unicode filenames aren't mangled by HFS:

Create a chromium directory for the checkout and change to it (you can call this whatever you like and put it wherever you like, as long as the full path has no spaces):

Run the fetch tool from depot_tools to check out the code and its dependencies.

If you don't need the full repo history, you can save time by using fetch --no-history chromium. You can call git fetch --unshallow to retrieve the full history later.

Expect the command to take 30 minutes on even a fast connection, and many hours on slower ones.

When fetch completes, it will have created a hidden .gclient file and a directory called src in the working directory. The remaining instructions assume you have switched to the src directory:

Optional: You can also install API keys if you want your build to talk to some Google services, but this is not necessary for most development and testing purposes.

Setting up the build

Chromium uses Ninja as its main build tool along with a tool called GN to generate .ninja files. You can create any number of build directories with different configurations. To create a build directory:

  • You only have to run this once for each new build directory, Ninja will update the build files as needed.
  • You can replace Default with another name, but it should be a subdirectory of out.
  • For other build arguments, including release settings, see GN build configuration. The default will be a debug component build matching the current host operating system and CPU.
  • For more info on GN, run gn help on the command line or read the quick start guide.

Faster builds

Full rebuilds are about the same speed in Debug and Release, but linking is a lot faster in Release builds.

Put

in your args.gn to do a release build.

Put

in your args.gn to build many small dylibs instead of a single large executable. Download dictionary for word mac. This makes incremental builds much faster, at the cost of producing a binary that opens less quickly. Component builds work in both debug and release.

Put

in your args.gn to disable debug symbols altogether. This makes both full rebuilds and linking faster (at the cost of not getting symbolized backtraces in gdb).

CCache

You might also want to install ccache to speed up the build.

Build Chromium

Build Chromium (the “chrome” target) with Ninja using the command:

(autoninja is a wrapper that automatically provides optimal values for the arguments passed to ninja.)

You can get a list of all of the other build targets from GN by running gn ls out/Default from the command line. To compile one, pass the GN label to Ninja with no preceding “//” (so, for //chrome/test:unit_tests use autoninja -C out/Default chrome/test:unit_tests).

Run Chromium

Once it is built, you can simply run the browser:

Avoiding the “incoming network connections” dialog

Every time you start a new developer build of Chrome you get a system dialog asking “Do you want the application Chromium.app to accept incoming network connections?” - to avoid this, run with this command-line flag:

Xiao wenge. --disable-features=“MediaRouter”

Running test targets

You can run the tests in the same way. You can also limit which tests are run using the --gtest_filter arg, e.g.:

You can find out more about GoogleTest at its GitHub page.

Debugging

Good debugging tips can be found here. If you would like to debug in a graphical environment, rather than using lldb at the command line, that is possible without building in Xcode (see Debugging in Xcode).

Tips for printing variables from lldb prompt (both in Xcode or in terminal):

  • If uptr is a std::unique_ptr, the address it wraps is accessible as uptr.__ptr_.__value_.
  • To pretty-print base::string16, ensure you have a ~/.lldbinit file and add the following line into it (substitute {SRC} for your actual path to the root of Chromium's sources):

Update your checkout

To update an existing checkout, you can run

The first command updates the primary Chromium source repository and rebases any of your local branches on top of tip-of-tree (aka the Git branch origin/master). If you don't want to use this script, you can also just use git pull or other common Git commands to update the repo.

The second command syncs dependencies to the appropriate versions and re-runs hooks as needed.

Tips, tricks, and troubleshooting

Using Xcode-Ninja Hybrid

While using Xcode is unsupported, GN supports a hybrid approach of using Ninja for building, but Xcode for editing and driving compilation. Xcode is still slow, but it runs fairly well even with indexing enabled. Most people build in the Terminal and write code with a text editor, though.

With hybrid builds, compilation is still handled by Ninja, and can be run from the command line (e.g. autoninja -C out/gn chrome) or by choosing the chrome target in the hybrid project and choosing Build.

To use Xcode-Ninja Hybrid pass --ide=xcode to gn gen:

Open it:

You may run into a problem where http://YES is opened as a new tab every time you launch Chrome. To fix this, open the scheme editor for the Run scheme, choose the Options tab, and uncheck “Allow debugging when using document Versions Browser”. When this option is checked, Xcode adds --NSDocumentRevisionsDebugMode YES to the launch arguments, and the YES gets interpreted as a URL to open.

If you have problems building, join us in #chromium on irc.freenode.net and ask there. Be sure that the waterfall is green and the tree is open before checking out. This will increase your chances of success.

Improving performance of git status

Increase the vnode cache size

git status is used frequently to determine the status of your checkout. Due to the large number of files in Chromium‘s checkout, git status performance can be quite variable. Increasing the system’s vnode cache appears to help. By default, this command:

Outputs kern.maxvnodes: 263168 (263168 is 257 * 1024). To increase this setting:

Higher values may be appropriate if you routinely move between different Chromium checkouts. This setting will reset on reboot, the startup setting can be set in /etc/sysctl.conf:

Or edit the file directly.

Configure git to use an untracked cache

If git --version reports 2.8 or higher, try running

If the output ends with OK, then the following may also improve performance of git status:

If git --version reports 2.6 or higher, but below 2.8, you can instead run Kingdom two crowns: ost for mac.

Xcode license agreement

If you're getting the error

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

the Xcode license hasn't been accepted yet which (contrary to the message) any user can do by running:

Chrome Os Source Code

Only accepting for all users of the machine requires root: