1// Copyright (c) 2011 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "base/prefs/pref_service.h"
6#include "chrome/browser/chromeos/settings/cros_settings.h"
7#include "chrome/browser/extensions/extension_apitest.h"
8#include "chrome/common/pref_names.h"
9#include "chromeos/settings/cros_settings_names.h"
10
11IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeOSInfoPrivateTest) {
12  // Set the initial timezone to a different one that JS function
13  // timezoneSetTest() will attempt to set.
14  base::StringValue initial_timezone("America/Los_Angeles");
15  chromeos::CrosSettings::Get()->Set(chromeos::kSystemTimezone,
16                                     initial_timezone);
17
18  // Check that accessability settings are set to default values.
19  PrefService* prefs = profile()->GetPrefs();
20  ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled));
21  ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityStickyKeysEnabled));
22  ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled));
23  ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityHighContrastEnabled));
24  ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled));
25  ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityAutoclickEnabled));
26
27  ASSERT_FALSE(profile()->GetPrefs()->GetBoolean(
28      prefs::kLanguageSendFunctionKeys));
29
30  ASSERT_TRUE(RunComponentExtensionTest("chromeos_info_private")) << message_;
31
32  // Check that accessability settings have been all flipped by the test.
33  ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled));
34  ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityStickyKeysEnabled));
35  ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled));
36  ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityHighContrastEnabled));
37  ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled));
38  ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityAutoclickEnabled));
39
40  ASSERT_TRUE(prefs->GetBoolean(prefs::kLanguageSendFunctionKeys));
41}
42