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 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #include "base/macros.h" | 24 #include "base/macros.h" |
25 #include "base/memory/ptr_util.h" | 25 #include "base/memory/ptr_util.h" |
26 #include "base/memory/ref_counted.h" | 26 #include "base/memory/ref_counted.h" |
27 #include "base/path_service.h" | 27 #include "base/path_service.h" |
28 #include "base/run_loop.h" | 28 #include "base/run_loop.h" |
29 #include "base/strings/string16.h" | 29 #include "base/strings/string16.h" |
30 #include "base/strings/string_number_conversions.h" | 30 #include "base/strings/string_number_conversions.h" |
31 #include "base/strings/string_util.h" | 31 #include "base/strings/string_util.h" |
32 #include "base/strings/stringprintf.h" | 32 #include "base/strings/stringprintf.h" |
33 #include "base/strings/utf_string_conversions.h" | 33 #include "base/strings/utf_string_conversions.h" |
34 #include "base/test/scoped_feature_list.h" | |
34 #include "base/test/test_file_util.h" | 35 #include "base/test/test_file_util.h" |
35 #include "base/threading/sequenced_worker_pool.h" | 36 #include "base/threading/sequenced_worker_pool.h" |
36 #include "base/time/time.h" | 37 #include "base/time/time.h" |
37 #include "base/values.h" | 38 #include "base/values.h" |
38 #include "build/build_config.h" | 39 #include "build/build_config.h" |
39 #include "chrome/app/chrome_command_ids.h" | 40 #include "chrome/app/chrome_command_ids.h" |
40 #include "chrome/browser/background/background_contents_service.h" | 41 #include "chrome/browser/background/background_contents_service.h" |
41 #include "chrome/browser/browser_process.h" | 42 #include "chrome/browser/browser_process.h" |
42 #include "chrome/browser/chrome_notification_types.h" | 43 #include "chrome/browser/chrome_notification_types.h" |
43 #include "chrome/browser/component_updater/chrome_component_updater_configurator .h" | 44 #include "chrome/browser/component_updater/chrome_component_updater_configurator .h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 #include "chrome/browser/translate/chrome_translate_client.h" | 77 #include "chrome/browser/translate/chrome_translate_client.h" |
77 #include "chrome/browser/translate/translate_service.h" | 78 #include "chrome/browser/translate/translate_service.h" |
78 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 79 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
79 #include "chrome/browser/ui/browser.h" | 80 #include "chrome/browser/ui/browser.h" |
80 #include "chrome/browser/ui/browser_commands.h" | 81 #include "chrome/browser/ui/browser_commands.h" |
81 #include "chrome/browser/ui/browser_list.h" | 82 #include "chrome/browser/ui/browser_list.h" |
82 #include "chrome/browser/ui/browser_tabstrip.h" | 83 #include "chrome/browser/ui/browser_tabstrip.h" |
83 #include "chrome/browser/ui/browser_window.h" | 84 #include "chrome/browser/ui/browser_window.h" |
84 #include "chrome/browser/ui/location_bar/location_bar.h" | 85 #include "chrome/browser/ui/location_bar/location_bar.h" |
85 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 86 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
87 #include "chrome/common/chrome_features.h" | |
86 #include "chrome/common/chrome_paths.h" | 88 #include "chrome/common/chrome_paths.h" |
87 #include "chrome/common/chrome_switches.h" | 89 #include "chrome/common/chrome_switches.h" |
88 #include "chrome/common/extensions/extension_constants.h" | 90 #include "chrome/common/extensions/extension_constants.h" |
89 #include "chrome/common/pref_names.h" | 91 #include "chrome/common/pref_names.h" |
90 #include "chrome/common/url_constants.h" | 92 #include "chrome/common/url_constants.h" |
91 #include "chrome/grit/generated_resources.h" | 93 #include "chrome/grit/generated_resources.h" |
92 #include "chrome/test/base/in_process_browser_test.h" | 94 #include "chrome/test/base/in_process_browser_test.h" |
93 #include "chrome/test/base/search_test_utils.h" | 95 #include "chrome/test/base/search_test_utils.h" |
94 #include "chrome/test/base/ui_test_utils.h" | 96 #include "chrome/test/base/ui_test_utils.h" |
95 #include "components/bookmarks/common/bookmark_pref_names.h" | 97 #include "components/bookmarks/common/bookmark_pref_names.h" |
(...skipping 4218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4314 } | 4316 } |
4315 | 4317 |
4316 void SetEmptyPolicy() { UpdateProviderPolicy(PolicyMap()); } | 4318 void SetEmptyPolicy() { UpdateProviderPolicy(PolicyMap()); } |
4317 | 4319 |
4318 bool CheckResolveTimezoneByGeolocation(bool checked, bool disabled) { | 4320 bool CheckResolveTimezoneByGeolocation(bool checked, bool disabled) { |
4319 checker.set_web_contents( | 4321 checker.set_web_contents( |
4320 browser()->tab_strip_model()->GetActiveWebContents()); | 4322 browser()->tab_strip_model()->GetActiveWebContents()); |
4321 const std::string expression = base::StringPrintf( | 4323 const std::string expression = base::StringPrintf( |
4322 "(function () {\n" | 4324 "(function () {\n" |
4323 " var checkbox = " | 4325 " var checkbox = " |
4324 "document.getElementById('resolve-timezone-by-geolocation');\n" | 4326 "document.getElementById('resolve-timezone-by-geolocation');\n" |
Dan Beam
2017/02/17 03:22:19
this is very specific to the old options page and
| |
4325 " if (!checkbox) {\n" | 4327 " if (!checkbox) {\n" |
4326 " console.log('resolve-timezone-by-geolocation not found.');\n" | 4328 " console.log('resolve-timezone-by-geolocation not found.');\n" |
4327 " return false;\n" | 4329 " return false;\n" |
4328 " }\n" | 4330 " }\n" |
4329 " var expected_checked = %s;\n" | 4331 " var expected_checked = %s;\n" |
4330 " var expected_disabled = %s;\n" | 4332 " var expected_disabled = %s;\n" |
4331 " var checked = checkbox.checked;\n" | 4333 " var checked = checkbox.checked;\n" |
4332 " var disabled = checkbox.disabled;\n" | 4334 " var disabled = checkbox.disabled;\n" |
4333 " if (checked != expected_checked)\n" | 4335 " if (checked != expected_checked)\n" |
4334 " console.log('ERROR: expected_checked=' + expected_checked + ' != " | 4336 " console.log('ERROR: expected_checked=' + expected_checked + ' != " |
(...skipping 10 matching lines...) Expand all Loading... | |
4345 return checker.GetBool(expression); | 4347 return checker.GetBool(expression); |
4346 } | 4348 } |
4347 | 4349 |
4348 private: | 4350 private: |
4349 chromeos::test::JSChecker checker; | 4351 chromeos::test::JSChecker checker; |
4350 | 4352 |
4351 DISALLOW_COPY_AND_ASSIGN(ChromeOSPolicyTest); | 4353 DISALLOW_COPY_AND_ASSIGN(ChromeOSPolicyTest); |
4352 }; | 4354 }; |
4353 | 4355 |
4354 IN_PROC_BROWSER_TEST_F(ChromeOSPolicyTest, SystemTimezoneAutomaticDetection) { | 4356 IN_PROC_BROWSER_TEST_F(ChromeOSPolicyTest, SystemTimezoneAutomaticDetection) { |
4357 base::test::ScopedFeatureList disable_md_settings; | |
4358 disable_md_settings.InitAndDisableFeature(features::kMaterialDesignSettings); | |
4359 | |
4355 ui_test_utils::NavigateToURL(browser(), GURL("chrome://settings")); | 4360 ui_test_utils::NavigateToURL(browser(), GURL("chrome://settings")); |
4356 chromeos::system::TimeZoneResolverManager* manager = | 4361 chromeos::system::TimeZoneResolverManager* manager = |
4357 g_browser_process->platform_part()->GetTimezoneResolverManager(); | 4362 g_browser_process->platform_part()->GetTimezoneResolverManager(); |
4358 | 4363 |
4359 // Policy not set. | 4364 // Policy not set. |
4360 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4365 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
4361 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4366 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
4362 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4367 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
4363 | 4368 |
4364 int policy_value = 0 /* USERS_DECIDE */; | 4369 int policy_value = 0 /* USERS_DECIDE */; |
(...skipping 28 matching lines...) Expand all Loading... | |
4393 | 4398 |
4394 SetEmptyPolicy(); | 4399 SetEmptyPolicy(); |
4395 // Policy not set. | 4400 // Policy not set. |
4396 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4401 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
4397 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4402 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
4398 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4403 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
4399 } | 4404 } |
4400 #endif // defined(OS_CHROMEOS) | 4405 #endif // defined(OS_CHROMEOS) |
4401 | 4406 |
4402 } // namespace policy | 4407 } // namespace policy |
OLD | NEW |