| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Font Settings Extension API browser tests. |
| 6 |
| 5 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 11 | 13 |
| 14 // Test of extension API on a standard profile. |
| 12 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FontSettings) { | 15 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FontSettings) { |
| 13 CommandLine::ForCurrentProcess()->AppendSwitch( | 16 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 14 switches::kEnableExperimentalExtensionApis); | 17 switches::kEnableExperimentalExtensionApis); |
| 15 | 18 |
| 16 PrefService* prefs = browser()->profile()->GetPrefs(); | 19 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 17 prefs->SetString(prefs::kWebKitStandardFontFamilyKorean, "Tahoma"); | 20 prefs->SetString(prefs::kWebKitStandardFontFamilyKorean, "Tahoma"); |
| 18 prefs->SetString(prefs::kWebKitSansSerifFontFamily, "Arial"); | 21 prefs->SetString(prefs::kWebKitSansSerifFontFamily, "Arial"); |
| 19 prefs->SetInteger(prefs::kWebKitDefaultFontSize, 16); | 22 prefs->SetInteger(prefs::kWebKitDefaultFontSize, 16); |
| 20 prefs->SetInteger(prefs::kWebKitDefaultFixedFontSize, 14); | 23 prefs->SetInteger(prefs::kWebKitDefaultFixedFontSize, 14); |
| 21 prefs->SetInteger(prefs::kWebKitMinimumFontSize, 8); | 24 prefs->SetInteger(prefs::kWebKitMinimumFontSize, 8); |
| 22 prefs->SetString(prefs::kDefaultCharset, "Shift_JIS"); | 25 prefs->SetString(prefs::kDefaultCharset, "Shift_JIS"); |
| 23 | 26 |
| 24 EXPECT_TRUE(RunExtensionTest("font_settings/standard")) << message_; | 27 EXPECT_TRUE(RunExtensionTest("font_settings/standard")) << message_; |
| 25 } | 28 } |
| 26 | 29 |
| 30 // Test of extension API in incognito split mode. |
| 27 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FontSettingsIncognito) { | 31 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FontSettingsIncognito) { |
| 28 CommandLine::ForCurrentProcess()->AppendSwitch( | 32 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 29 switches::kEnableExperimentalExtensionApis); | 33 switches::kEnableExperimentalExtensionApis); |
| 30 | 34 |
| 31 PrefService* prefs = browser()->profile()->GetPrefs(); | 35 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 32 prefs->SetString(prefs::kWebKitStandardFontFamilyKorean, "Tahoma"); | 36 prefs->SetString(prefs::kWebKitStandardFontFamilyKorean, "Tahoma"); |
| 33 prefs->SetString(prefs::kWebKitSansSerifFontFamily, "Arial"); | 37 prefs->SetString(prefs::kWebKitSansSerifFontFamily, "Arial"); |
| 34 prefs->SetInteger(prefs::kWebKitDefaultFontSize, 16); | 38 prefs->SetInteger(prefs::kWebKitDefaultFontSize, 16); |
| 35 | 39 |
| 36 int flags = ExtensionApiTest::kFlagEnableIncognito | | 40 int flags = ExtensionApiTest::kFlagEnableIncognito | |
| 37 ExtensionApiTest::kFlagUseIncognito; | 41 ExtensionApiTest::kFlagUseIncognito; |
| 38 EXPECT_TRUE(RunExtensionSubtest("font_settings/incognito", | 42 EXPECT_TRUE(RunExtensionSubtest("font_settings/incognito", |
| 39 "launch.html", | 43 "launch.html", |
| 40 flags)); | 44 flags)); |
| 41 } | 45 } |
| OLD | NEW |