| 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/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_tabstrip.h" | 16 #include "chrome/browser/ui/browser_tabstrip.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
| 21 #include "chrome/test/base/testing_profile.h" |
| 21 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
| 22 #include "content/public/browser/notification_details.h" | 23 #include "content/public/browser/notification_details.h" |
| 23 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 25 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
| 26 | 27 |
| 27 // This file contains high-level startup tests for the extensions system. We've | 28 // This file contains high-level startup tests for the extensions system. We've |
| 28 // had many silly bugs where command line flags did not get propagated correctly | 29 // had many silly bugs where command line flags did not get propagated correctly |
| 29 // into the services, so we didn't start correctly. | 30 // into the services, so we didn't start correctly. |
| 30 | 31 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 46 FilePath::StringType paths = JoinString(load_extensions_, ','); | 47 FilePath::StringType paths = JoinString(load_extensions_, ','); |
| 47 command_line->AppendSwitchNative(switches::kLoadExtension, | 48 command_line->AppendSwitchNative(switches::kLoadExtension, |
| 48 paths); | 49 paths); |
| 49 command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck); | 50 command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck); |
| 50 } | 51 } |
| 51 } | 52 } |
| 52 | 53 |
| 53 virtual bool SetUpUserDataDirectory() { | 54 virtual bool SetUpUserDataDirectory() { |
| 54 FilePath profile_dir; | 55 FilePath profile_dir; |
| 55 PathService::Get(chrome::DIR_USER_DATA, &profile_dir); | 56 PathService::Get(chrome::DIR_USER_DATA, &profile_dir); |
| 56 profile_dir = profile_dir.AppendASCII("Default"); | 57 profile_dir = profile_dir.AppendASCII(TestingProfile::kTestUserProfileDir); |
| 57 file_util::CreateDirectory(profile_dir); | 58 file_util::CreateDirectory(profile_dir); |
| 58 | 59 |
| 59 preferences_file_ = profile_dir.AppendASCII("Preferences"); | 60 preferences_file_ = profile_dir.AppendASCII("Preferences"); |
| 60 user_scripts_dir_ = profile_dir.AppendASCII("User Scripts"); | 61 user_scripts_dir_ = profile_dir.AppendASCII("User Scripts"); |
| 61 extensions_dir_ = profile_dir.AppendASCII("Extensions"); | 62 extensions_dir_ = profile_dir.AppendASCII("Extensions"); |
| 62 | 63 |
| 63 if (enable_extensions_ && load_extensions_.empty()) { | 64 if (enable_extensions_ && load_extensions_.empty()) { |
| 64 FilePath src_dir; | 65 FilePath src_dir; |
| 65 PathService::Get(chrome::DIR_TEST_DATA, &src_dir); | 66 PathService::Get(chrome::DIR_TEST_DATA, &src_dir); |
| 66 src_dir = src_dir.AppendASCII("extensions").AppendASCII("good"); | 67 src_dir = src_dir.AppendASCII("extensions").AppendASCII("good"); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 .AppendASCII("extensions") | 262 .AppendASCII("extensions") |
| 262 .AppendASCII("app2"); | 263 .AppendASCII("app2"); |
| 263 load_extensions_.push_back(fourth_extension_path.value()); | 264 load_extensions_.push_back(fourth_extension_path.value()); |
| 264 } | 265 } |
| 265 }; | 266 }; |
| 266 | 267 |
| 267 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { | 268 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { |
| 268 WaitForServicesToStart(4, true); | 269 WaitForServicesToStart(4, true); |
| 269 TestInjection(true, true); | 270 TestInjection(true, true); |
| 270 } | 271 } |
| OLD | NEW |