Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: chrome/browser/extensions/extension_browsertest.cc

Issue 565523003: Add scoped path overrides for system directories for ExtensionBrowserTests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 set_chromeos_user_(true), 64 set_chromeos_user_(true),
65 #endif 65 #endif
66 // Default channel is STABLE but override with UNKNOWN so that unlaunched 66 // Default channel is STABLE but override with UNKNOWN so that unlaunched
67 // or incomplete APIs can write tests. 67 // or incomplete APIs can write tests.
68 current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN), 68 current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN),
69 override_prompt_for_external_extensions_( 69 override_prompt_for_external_extensions_(
70 FeatureSwitch::prompt_for_external_extensions(), 70 FeatureSwitch::prompt_for_external_extensions(),
71 false), 71 false),
72 profile_(NULL) { 72 profile_(NULL) {
73 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); 73 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
74
75 EXPECT_TRUE(fake_user_desktop_.CreateUniqueTempDir());
76 EXPECT_TRUE(fake_common_desktop_.CreateUniqueTempDir());
77 EXPECT_TRUE(fake_user_quick_launch_.CreateUniqueTempDir());
78 EXPECT_TRUE(fake_default_user_quick_launch_.CreateUniqueTempDir());
79 EXPECT_TRUE(fake_start_menu_.CreateUniqueTempDir());
80 EXPECT_TRUE(fake_common_start_menu_.CreateUniqueTempDir());
81 user_desktop_override_.reset(
82 new base::ScopedPathOverride(base::DIR_USER_DESKTOP,
83 fake_user_desktop_.path()));
84 common_desktop_override_.reset(
85 new base::ScopedPathOverride(base::DIR_COMMON_DESKTOP,
86 fake_common_desktop_.path()));
87 user_quick_launch_override_.reset(
88 new base::ScopedPathOverride(base::DIR_USER_QUICK_LAUNCH,
89 fake_user_quick_launch_.path()));
90 start_menu_override_.reset(
91 new base::ScopedPathOverride(base::DIR_START_MENU,
92 fake_start_menu_.path()));
93 common_start_menu_override_.reset(
94 new base::ScopedPathOverride(base::DIR_COMMON_START_MENU,
95 fake_common_start_menu_.path()));
74 } 96 }
75 97
76 ExtensionBrowserTest::~ExtensionBrowserTest() { 98 ExtensionBrowserTest::~ExtensionBrowserTest() {
77 } 99 }
78 100
79 Profile* ExtensionBrowserTest::profile() { 101 Profile* ExtensionBrowserTest::profile() {
80 if (!profile_) { 102 if (!profile_) {
81 if (browser()) 103 if (browser())
82 profile_ = browser()->profile(); 104 profile_ = browser()->profile();
83 else 105 else
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 return extensions::browsertest_util::ExecuteScriptInBackgroundPage( 667 return extensions::browsertest_util::ExecuteScriptInBackgroundPage(
646 profile(), extension_id, script); 668 profile(), extension_id, script);
647 } 669 }
648 670
649 bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait( 671 bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait(
650 const std::string& extension_id, 672 const std::string& extension_id,
651 const std::string& script) { 673 const std::string& script) {
652 return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait( 674 return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait(
653 profile(), extension_id, script); 675 profile(), extension_id, script);
654 } 676 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698