// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/40285824): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif #include <stddef.h> #include <memory> #include "base/command_line.h" #include "base/environment.h" #include "build/build_config.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/test/browser_test.h" #include "ui/base/ui_base_switches.h" namespace { // A class that over-writes the system locale only in a scope. To emulate the // specified environment on Linux, this class over-writes a LC_ALL environment // variable when creating a LocaleTest object and restore it with the original // value when deleting the object. (This environment variable may affect other // tests and we have to restore it regardless of the results of LocaleTests.) class ScopedLocale { … }; // A base class for tests used in this file. This class over-writes the system // locale and run Chrome with a '--lang' option. To add a new LocaleTest, add a // class derived from this class and call the constructor with the locale name // used by Chrome. class LocaleTestBase : public InProcessBrowserTest { … }; // Test classes that run Chrome on the Danish locale, the Hebrew locale, and // the Traditional-Chinese locale, respectively. class LocaleTestDanish : public LocaleTestBase { … }; class LocaleTestHebrew : public LocaleTestBase { … }; class LocaleTestTraditionalChinese : public LocaleTestBase { … }; } // namespace // Start Chrome and shut it down on the Danish locale, the Hebrew locale, and // the Traditional-Chinese locale, respectively. These tests do not need any // code here because they just verify we can start Chrome and shut it down // cleanly on these locales. IN_PROC_BROWSER_TEST_F(LocaleTestDanish, TestStart) { … } IN_PROC_BROWSER_TEST_F(LocaleTestHebrew, TestStart) { … } IN_PROC_BROWSER_TEST_F(LocaleTestTraditionalChinese, TestStart) { … }