| 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 <vector> |    5 #include <vector> | 
|    6  |    6  | 
|    7 #include "base/command_line.h" |    7 #include "base/command_line.h" | 
|    8 #include "base/files/file_path.h" |    8 #include "base/files/file_path.h" | 
|    9 #include "base/files/file_util.h" |    9 #include "base/files/file_util.h" | 
|   10 #include "base/path_service.h" |   10 #include "base/path_service.h" | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   43 // into the services, so we didn't start correctly. |   43 // into the services, so we didn't start correctly. | 
|   44  |   44  | 
|   45 class ExtensionStartupTestBase : public InProcessBrowserTest { |   45 class ExtensionStartupTestBase : public InProcessBrowserTest { | 
|   46  public: |   46  public: | 
|   47   ExtensionStartupTestBase() : unauthenticated_load_allowed_(true) { |   47   ExtensionStartupTestBase() : unauthenticated_load_allowed_(true) { | 
|   48     num_expected_extensions_ = 3; |   48     num_expected_extensions_ = 3; | 
|   49   } |   49   } | 
|   50  |   50  | 
|   51  protected: |   51  protected: | 
|   52   // InProcessBrowserTest |   52   // InProcessBrowserTest | 
|   53   virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |   53   virtual void SetUpCommandLine(CommandLine* command_line) override { | 
|   54     if (load_extensions_.empty()) { |   54     if (load_extensions_.empty()) { | 
|   55       // If no |load_extensions_| were specified, allow unauthenticated |   55       // If no |load_extensions_| were specified, allow unauthenticated | 
|   56       // extension settings to be loaded from Preferences as if they had been |   56       // extension settings to be loaded from Preferences as if they had been | 
|   57       // authenticated correctly before they were handed to the ExtensionSystem. |   57       // authenticated correctly before they were handed to the ExtensionSystem. | 
|   58       command_line->AppendSwitchASCII( |   58       command_line->AppendSwitchASCII( | 
|   59           switches::kForceFieldTrials, |   59           switches::kForceFieldTrials, | 
|   60           base::StringPrintf( |   60           base::StringPrintf( | 
|   61               "%s/%s/", |   61               "%s/%s/", | 
|   62               chrome_prefs::internals::kSettingsEnforcementTrialName, |   62               chrome_prefs::internals::kSettingsEnforcementTrialName, | 
|   63               chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement)); |   63               chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement)); | 
|   64 #if defined(OFFICIAL_BUILD) && defined(OS_WIN) |   64 #if defined(OFFICIAL_BUILD) && defined(OS_WIN) | 
|   65       // In Windows official builds, it is not possible to disable settings |   65       // In Windows official builds, it is not possible to disable settings | 
|   66       // authentication. |   66       // authentication. | 
|   67       unauthenticated_load_allowed_ = false; |   67       unauthenticated_load_allowed_ = false; | 
|   68 #endif |   68 #endif | 
|   69     } else { |   69     } else { | 
|   70       base::FilePath::StringType paths = JoinString(load_extensions_, ','); |   70       base::FilePath::StringType paths = JoinString(load_extensions_, ','); | 
|   71       command_line->AppendSwitchNative(switches::kLoadExtension, |   71       command_line->AppendSwitchNative(switches::kLoadExtension, | 
|   72                                        paths); |   72                                        paths); | 
|   73       command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck); |   73       command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck); | 
|   74     } |   74     } | 
|   75   } |   75   } | 
|   76  |   76  | 
|   77   virtual bool SetUpUserDataDirectory() OVERRIDE { |   77   virtual bool SetUpUserDataDirectory() override { | 
|   78     base::FilePath profile_dir; |   78     base::FilePath profile_dir; | 
|   79     PathService::Get(chrome::DIR_USER_DATA, &profile_dir); |   79     PathService::Get(chrome::DIR_USER_DATA, &profile_dir); | 
|   80     profile_dir = profile_dir.AppendASCII(TestingProfile::kTestUserProfileDir); |   80     profile_dir = profile_dir.AppendASCII(TestingProfile::kTestUserProfileDir); | 
|   81     base::CreateDirectory(profile_dir); |   81     base::CreateDirectory(profile_dir); | 
|   82  |   82  | 
|   83     preferences_file_ = profile_dir.Append(chrome::kPreferencesFilename); |   83     preferences_file_ = profile_dir.Append(chrome::kPreferencesFilename); | 
|   84     user_scripts_dir_ = profile_dir.AppendASCII("User Scripts"); |   84     user_scripts_dir_ = profile_dir.AppendASCII("User Scripts"); | 
|   85     extensions_dir_ = profile_dir.AppendASCII("Extensions"); |   85     extensions_dir_ = profile_dir.AppendASCII("Extensions"); | 
|   86  |   86  | 
|   87     if (load_extensions_.empty()) { |   87     if (load_extensions_.empty()) { | 
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  293         .AppendASCII("extensions") |  293         .AppendASCII("extensions") | 
|  294         .AppendASCII("app2"); |  294         .AppendASCII("app2"); | 
|  295     load_extensions_.push_back(fourth_extension_path.value()); |  295     load_extensions_.push_back(fourth_extension_path.value()); | 
|  296   } |  296   } | 
|  297 }; |  297 }; | 
|  298  |  298  | 
|  299 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { |  299 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { | 
|  300   WaitForServicesToStart(4, true); |  300   WaitForServicesToStart(4, true); | 
|  301   TestInjection(true, true); |  301   TestInjection(true, true); | 
|  302 } |  302 } | 
| OLD | NEW |