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

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc

Issue 274193008: Create a temp download directory for WebstorePrivateApiTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector> 5 #include <vector>
6 6
7 #include "base/callback_list.h" 7 #include "base/callback_list.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Grab references to the fake signin manager and token service. 150 // Grab references to the fake signin manager and token service.
151 signin_manager_ = 151 signin_manager_ =
152 static_cast<FakeSigninManagerForTesting*>( 152 static_cast<FakeSigninManagerForTesting*>(
153 SigninManagerFactory::GetInstance()->GetForProfile(profile())); 153 SigninManagerFactory::GetInstance()->GetForProfile(profile()));
154 ASSERT_TRUE(signin_manager_); 154 ASSERT_TRUE(signin_manager_);
155 token_service_ = 155 token_service_ =
156 static_cast<FakeProfileOAuth2TokenService*>( 156 static_cast<FakeProfileOAuth2TokenService*>(
157 ProfileOAuth2TokenServiceFactory::GetInstance()->GetForProfile( 157 ProfileOAuth2TokenServiceFactory::GetInstance()->GetForProfile(
158 profile())); 158 profile()));
159 ASSERT_TRUE(token_service_); 159 ASSERT_TRUE(token_service_);
160
161 ASSERT_TRUE(webstore_install_dir_.CreateUniqueTempDir());
162 webstore_install_dir_copy_ = webstore_install_dir_.path();
163 WebstoreInstaller::SetDownloadDirectoryForTests(
164 &webstore_install_dir_copy_);
160 } 165 }
161 166
162 protected: 167 protected:
163 // Returns a test server URL, but with host 'www.example.com' so it matches 168 // Returns a test server URL, but with host 'www.example.com' so it matches
164 // the web store app's extent that we set up via command line flags. 169 // the web store app's extent that we set up via command line flags.
165 virtual GURL GetTestServerURL(const std::string& path) { 170 virtual GURL GetTestServerURL(const std::string& path) {
166 GURL url = test_server()->GetURL( 171 GURL url = test_server()->GetURL(
167 std::string("files/extensions/api_test/webstore_private/") + path); 172 std::string("files/extensions/api_test/webstore_private/") + path);
168 173
169 // Replace the host with 'www.example.com' so it matches the web store 174 // Replace the host with 'www.example.com' so it matches the web store
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return browser()->profile()->GetExtensionService(); 221 return browser()->profile()->GetExtensionService();
217 } 222 }
218 223
219 FakeSigninManagerForTesting* signin_manager_; 224 FakeSigninManagerForTesting* signin_manager_;
220 FakeProfileOAuth2TokenService* token_service_; 225 FakeProfileOAuth2TokenService* token_service_;
221 226
222 private: 227 private:
223 scoped_ptr<base::CallbackList<void(content::BrowserContext*)>::Subscription> 228 scoped_ptr<base::CallbackList<void(content::BrowserContext*)>::Subscription>
224 will_create_browser_context_services_subscription_; 229 will_create_browser_context_services_subscription_;
225 230
231 base::ScopedTempDir webstore_install_dir_;
232 // WebstoreInstaller needs a reference to a FilePath when setting the download
233 // directory for testing.
234 base::FilePath webstore_install_dir_copy_;
226 }; 235 };
227 236
228 // Test cases for webstore origin frame blocking. 237 // Test cases for webstore origin frame blocking.
229 // TODO(mkwst): Disabled until new X-Frame-Options behavior rolls into 238 // TODO(mkwst): Disabled until new X-Frame-Options behavior rolls into
230 // Chromium, see crbug.com/226018. 239 // Chromium, see crbug.com/226018.
231 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, 240 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
232 DISABLED_FrameWebstorePageBlocked) { 241 DISABLED_FrameWebstorePageBlocked) {
233 base::string16 expected_title = base::UTF8ToUTF16("PASS: about:blank"); 242 base::string16 expected_title = base::UTF8ToUTF16("PASS: about:blank");
234 base::string16 failure_title = base::UTF8ToUTF16("FAIL"); 243 base::string16 failure_title = base::UTF8ToUTF16("FAIL");
235 content::TitleWatcher watcher(GetWebContents(), expected_title); 244 content::TitleWatcher watcher(GetWebContents(), expected_title);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 content::Source<content::NavigationController>( 571 content::Source<content::NavigationController>(
563 &GetWebContents()->GetController())); 572 &GetWebContents()->GetController()));
564 StartSignInTest("sign_in_redirect_to_sign_in.html"); 573 StartSignInTest("sign_in_redirect_to_sign_in.html");
565 observer.Wait(); 574 observer.Wait();
566 575
567 // TODO(isherman): Also test the redirect back to the continue URL once 576 // TODO(isherman): Also test the redirect back to the continue URL once
568 // sign-in completes? 577 // sign-in completes?
569 } 578 }
570 579
571 } // namespace extensions 580 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698