| 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/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/user_script_master.h" | 13 #include "chrome/browser/extensions/user_script_master.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
| 20 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
| 21 #include "content/public/browser/notification_details.h" | 22 #include "content/public/browser/notification_details.h" |
| 22 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 24 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 45 FilePath::StringType paths = JoinString(load_extensions_, ','); | 46 FilePath::StringType paths = JoinString(load_extensions_, ','); |
| 46 command_line->AppendSwitchNative(switches::kLoadExtension, | 47 command_line->AppendSwitchNative(switches::kLoadExtension, |
| 47 paths); | 48 paths); |
| 48 command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck); | 49 command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck); |
| 49 } | 50 } |
| 50 } | 51 } |
| 51 | 52 |
| 52 virtual bool SetUpUserDataDirectory() { | 53 virtual bool SetUpUserDataDirectory() { |
| 53 FilePath profile_dir; | 54 FilePath profile_dir; |
| 54 PathService::Get(chrome::DIR_USER_DATA, &profile_dir); | 55 PathService::Get(chrome::DIR_USER_DATA, &profile_dir); |
| 55 profile_dir = profile_dir.AppendASCII("Default"); | 56 profile_dir = profile_dir.AppendASCII(ProfileManager::kTestUserProfile); |
| 56 file_util::CreateDirectory(profile_dir); | 57 file_util::CreateDirectory(profile_dir); |
| 57 | 58 |
| 58 preferences_file_ = profile_dir.AppendASCII("Preferences"); | 59 preferences_file_ = profile_dir.AppendASCII("Preferences"); |
| 59 user_scripts_dir_ = profile_dir.AppendASCII("User Scripts"); | 60 user_scripts_dir_ = profile_dir.AppendASCII("User Scripts"); |
| 60 extensions_dir_ = profile_dir.AppendASCII("Extensions"); | 61 extensions_dir_ = profile_dir.AppendASCII("Extensions"); |
| 61 | 62 |
| 62 if (enable_extensions_ && load_extensions_.empty()) { | 63 if (enable_extensions_ && load_extensions_.empty()) { |
| 63 FilePath src_dir; | 64 FilePath src_dir; |
| 64 PathService::Get(chrome::DIR_TEST_DATA, &src_dir); | 65 PathService::Get(chrome::DIR_TEST_DATA, &src_dir); |
| 65 src_dir = src_dir.AppendASCII("extensions").AppendASCII("good"); | 66 src_dir = src_dir.AppendASCII("extensions").AppendASCII("good"); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 .AppendASCII("extensions") | 260 .AppendASCII("extensions") |
| 260 .AppendASCII("app2"); | 261 .AppendASCII("app2"); |
| 261 load_extensions_.push_back(fourth_extension_path.value()); | 262 load_extensions_.push_back(fourth_extension_path.value()); |
| 262 } | 263 } |
| 263 }; | 264 }; |
| 264 | 265 |
| 265 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { | 266 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { |
| 266 WaitForServicesToStart(4, true); | 267 WaitForServicesToStart(4, true); |
| 267 TestInjection(true, true); | 268 TestInjection(true, true); |
| 268 } | 269 } |
| OLD | NEW |