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 "chrome/browser/extensions/extension_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/test/scoped_path_override.h" |
17 #include "chrome/browser/extensions/browsertest_util.h" | 18 #include "chrome/browser/extensions/browsertest_util.h" |
18 #include "chrome/browser/extensions/component_loader.h" | 19 #include "chrome/browser/extensions/component_loader.h" |
19 #include "chrome/browser/extensions/crx_installer.h" | 20 #include "chrome/browser/extensions/crx_installer.h" |
20 #include "chrome/browser/extensions/extension_creator.h" | 21 #include "chrome/browser/extensions/extension_creator.h" |
21 #include "chrome/browser/extensions/extension_error_reporter.h" | 22 #include "chrome/browser/extensions/extension_error_reporter.h" |
22 #include "chrome/browser/extensions/extension_install_prompt.h" | 23 #include "chrome/browser/extensions/extension_install_prompt.h" |
23 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
24 #include "chrome/browser/extensions/extension_util.h" | 25 #include "chrome/browser/extensions/extension_util.h" |
25 #include "chrome/browser/extensions/unpacked_installer.h" | 26 #include "chrome/browser/extensions/unpacked_installer.h" |
26 #include "chrome/browser/extensions/updater/extension_cache_fake.h" | 27 #include "chrome/browser/extensions/updater/extension_cache_fake.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 set_chromeos_user_(true), | 65 set_chromeos_user_(true), |
65 #endif | 66 #endif |
66 // Default channel is STABLE but override with UNKNOWN so that unlaunched | 67 // Default channel is STABLE but override with UNKNOWN so that unlaunched |
67 // or incomplete APIs can write tests. | 68 // or incomplete APIs can write tests. |
68 current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN), | 69 current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN), |
69 override_prompt_for_external_extensions_( | 70 override_prompt_for_external_extensions_( |
70 FeatureSwitch::prompt_for_external_extensions(), | 71 FeatureSwitch::prompt_for_external_extensions(), |
71 false), | 72 false), |
72 profile_(NULL) { | 73 profile_(NULL) { |
73 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 74 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 75 |
| 76 user_desktop_override_.reset( |
| 77 new base::ScopedPathOverride(base::DIR_USER_DESKTOP)); |
| 78 common_desktop_override_.reset( |
| 79 new base::ScopedPathOverride(base::DIR_COMMON_DESKTOP)); |
| 80 user_quick_launch_override_.reset( |
| 81 new base::ScopedPathOverride(base::DIR_USER_QUICK_LAUNCH)); |
| 82 start_menu_override_.reset( |
| 83 new base::ScopedPathOverride(base::DIR_START_MENU)); |
| 84 common_start_menu_override_.reset( |
| 85 new base::ScopedPathOverride(base::DIR_COMMON_START_MENU)); |
74 } | 86 } |
75 | 87 |
76 ExtensionBrowserTest::~ExtensionBrowserTest() { | 88 ExtensionBrowserTest::~ExtensionBrowserTest() { |
77 } | 89 } |
78 | 90 |
79 Profile* ExtensionBrowserTest::profile() { | 91 Profile* ExtensionBrowserTest::profile() { |
80 if (!profile_) { | 92 if (!profile_) { |
81 if (browser()) | 93 if (browser()) |
82 profile_ = browser()->profile(); | 94 profile_ = browser()->profile(); |
83 else | 95 else |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 return extensions::browsertest_util::ExecuteScriptInBackgroundPage( | 657 return extensions::browsertest_util::ExecuteScriptInBackgroundPage( |
646 profile(), extension_id, script); | 658 profile(), extension_id, script); |
647 } | 659 } |
648 | 660 |
649 bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait( | 661 bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait( |
650 const std::string& extension_id, | 662 const std::string& extension_id, |
651 const std::string& script) { | 663 const std::string& script) { |
652 return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait( | 664 return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait( |
653 profile(), extension_id, script); | 665 profile(), extension_id, script); |
654 } | 666 } |
OLD | NEW |