| 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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 extension_paths.push_back(path.value()); | 768 extension_paths.push_back(path.value()); |
| 769 if (bg_page.length()) | 769 if (bg_page.length()) |
| 770 bg_pages_tmp.push_back(bg_page); | 770 bg_pages_tmp.push_back(bg_page); |
| 771 } | 771 } |
| 772 | 772 |
| 773 if (include_automation_extension) { | 773 if (include_automation_extension) { |
| 774 base::FilePath automation_extension; | 774 base::FilePath automation_extension; |
| 775 Status status = UnpackAutomationExtension(temp_dir, &automation_extension); | 775 Status status = UnpackAutomationExtension(temp_dir, &automation_extension); |
| 776 if (status.IsError()) | 776 if (status.IsError()) |
| 777 return status; | 777 return status; |
| 778 #if defined(OS_WIN) || defined(OS_MACOSX) | |
| 779 // On Chrome for Windows and Mac, a "Disable developer mode extensions" | |
| 780 // dialog appears for the automation extension. Suppress this by loading | |
| 781 // it as a component extension. | |
| 782 UpdateExtensionSwitch(switches, "load-component-extension", | |
| 783 automation_extension.value()); | |
| 784 #else | |
| 785 if (switches->HasSwitch("disable-extensions")) { | 778 if (switches->HasSwitch("disable-extensions")) { |
| 786 // For Chrome 56 and earlier: | 779 UpdateExtensionSwitch(switches, "disable-extensions-except", |
| 780 automation_extension.value()); |
| 781 // TODO(samuong): Stop using --load-component-extension when ChromeDriver |
| 782 // stops supporting Chrome 56. For backwards compatibility, Chrome 57 and |
| 783 // 58 interprets --load-component-extension as --load-extension. |
| 787 UpdateExtensionSwitch(switches, "load-component-extension", | 784 UpdateExtensionSwitch(switches, "load-component-extension", |
| 788 automation_extension.value()); | 785 automation_extension.value()); |
| 789 // For Chrome 57 and later: | 786 } else { |
| 790 UpdateExtensionSwitch(switches, "disable-extensions-except", | 787 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 788 // On Chrome 56 for Windows and Mac, a "Disable developer |
| 789 // mode extensions" dialog appears for the automation extension. Suppress |
| 790 // this by loading it as a component extension. |
| 791 UpdateExtensionSwitch(switches, "load-component-extension", |
| 791 automation_extension.value()); | 792 automation_extension.value()); |
| 792 } else { | 793 #else |
| 793 extension_paths.push_back(automation_extension.value()); | 794 extension_paths.push_back(automation_extension.value()); |
| 795 #endif |
| 794 } | 796 } |
| 795 #endif | |
| 796 } | 797 } |
| 797 | 798 |
| 798 if (extension_paths.size()) { | 799 if (extension_paths.size()) { |
| 799 base::FilePath::StringType extension_paths_value = base::JoinString( | 800 base::FilePath::StringType extension_paths_value = base::JoinString( |
| 800 extension_paths, base::FilePath::StringType(1, ',')); | 801 extension_paths, base::FilePath::StringType(1, ',')); |
| 801 UpdateExtensionSwitch(switches, "load-extension", extension_paths_value); | 802 UpdateExtensionSwitch(switches, "load-extension", extension_paths_value); |
| 802 } | 803 } |
| 803 bg_pages->swap(bg_pages_tmp); | 804 bg_pages->swap(bg_pages_tmp); |
| 804 return Status(kOk); | 805 return Status(kOk); |
| 805 } | 806 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 // Write empty "First Run" file, otherwise Chrome will wipe the default | 881 // Write empty "First Run" file, otherwise Chrome will wipe the default |
| 881 // profile that was written. | 882 // profile that was written. |
| 882 if (base::WriteFile( | 883 if (base::WriteFile( |
| 883 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 884 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { |
| 884 return Status(kUnknownError, "failed to write first run file"); | 885 return Status(kUnknownError, "failed to write first run file"); |
| 885 } | 886 } |
| 886 return Status(kOk); | 887 return Status(kOk); |
| 887 } | 888 } |
| 888 | 889 |
| 889 } // namespace internal | 890 } // namespace internal |
| OLD | NEW |