OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/test/chromedriver/chrome_launcher.h" | 5 #include "chrome/test/chromedriver/chrome_launcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 if (status.IsError()) | 776 if (status.IsError()) |
777 return status; | 777 return status; |
778 #if defined(OS_WIN) || defined(OS_MACOSX) | 778 #if defined(OS_WIN) || defined(OS_MACOSX) |
779 // On Chrome for Windows and Mac, a "Disable developer mode extensions" | 779 // On Chrome for Windows and Mac, a "Disable developer mode extensions" |
780 // dialog appears for the automation extension. Suppress this by loading | 780 // dialog appears for the automation extension. Suppress this by loading |
781 // it as a component extension. | 781 // it as a component extension. |
782 UpdateExtensionSwitch(switches, "load-component-extension", | 782 UpdateExtensionSwitch(switches, "load-component-extension", |
783 automation_extension.value()); | 783 automation_extension.value()); |
784 #else | 784 #else |
785 if (switches->HasSwitch("disable-extensions")) { | 785 if (switches->HasSwitch("disable-extensions")) { |
| 786 // For Chrome 56 and earlier: |
786 UpdateExtensionSwitch(switches, "load-component-extension", | 787 UpdateExtensionSwitch(switches, "load-component-extension", |
787 automation_extension.value()); | 788 automation_extension.value()); |
| 789 // For Chrome 57 and later: |
| 790 UpdateExtensionSwitch(switches, "disable-extensions-except", |
| 791 automation_extension.value()); |
788 } else { | 792 } else { |
789 extension_paths.push_back(automation_extension.value()); | 793 extension_paths.push_back(automation_extension.value()); |
790 } | 794 } |
791 #endif | 795 #endif |
792 } | 796 } |
793 | 797 |
794 if (extension_paths.size()) { | 798 if (extension_paths.size()) { |
795 base::FilePath::StringType extension_paths_value = base::JoinString( | 799 base::FilePath::StringType extension_paths_value = base::JoinString( |
796 extension_paths, base::FilePath::StringType(1, ',')); | 800 extension_paths, base::FilePath::StringType(1, ',')); |
797 UpdateExtensionSwitch(switches, "load-extension", extension_paths_value); | 801 UpdateExtensionSwitch(switches, "load-extension", extension_paths_value); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 // Write empty "First Run" file, otherwise Chrome will wipe the default | 880 // Write empty "First Run" file, otherwise Chrome will wipe the default |
877 // profile that was written. | 881 // profile that was written. |
878 if (base::WriteFile( | 882 if (base::WriteFile( |
879 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 883 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { |
880 return Status(kUnknownError, "failed to write first run file"); | 884 return Status(kUnknownError, "failed to write first run file"); |
881 } | 885 } |
882 return Status(kOk); | 886 return Status(kOk); |
883 } | 887 } |
884 | 888 |
885 } // namespace internal | 889 } // namespace internal |
OLD | NEW |