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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc

Issue 2825963003: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/extensions (Closed)
Patch Set: Created 3 years, 8 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 // Disable everything on windows only. http://crbug.com/306144 5 // Disable everything on windows only. http://crbug.com/306144
6 #ifndef OS_WIN 6 #ifndef OS_WIN
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 downloads::OnDeterminingFilename::kEventName, host, GetExtensionId()); 307 downloads::OnDeterminingFilename::kEventName, host, GetExtensionId());
308 } 308 }
309 309
310 Browser* current_browser() { return current_browser_; } 310 Browser* current_browser() { return current_browser_; }
311 311
312 // InProcessBrowserTest 312 // InProcessBrowserTest
313 void SetUpOnMainThread() override { 313 void SetUpOnMainThread() override {
314 ExtensionApiTest::SetUpOnMainThread(); 314 ExtensionApiTest::SetUpOnMainThread();
315 BrowserThread::PostTask( 315 BrowserThread::PostTask(
316 BrowserThread::IO, FROM_HERE, 316 BrowserThread::IO, FROM_HERE,
317 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); 317 base::BindOnce(&chrome_browser_net::SetUrlRequestMocksEnabled, true));
318 InProcessBrowserTest::SetUpOnMainThread(); 318 InProcessBrowserTest::SetUpOnMainThread();
319 GoOnTheRecord(); 319 GoOnTheRecord();
320 CreateAndSetDownloadsDirectory(); 320 CreateAndSetDownloadsDirectory();
321 current_browser()->profile()->GetPrefs()->SetBoolean( 321 current_browser()->profile()->GetPrefs()->SetBoolean(
322 prefs::kPromptForDownload, false); 322 prefs::kPromptForDownload, false);
323 events_listener_.reset(new DownloadsEventsListener()); 323 events_listener_.reset(new DownloadsEventsListener());
324 // Disable file chooser for current profile. 324 // Disable file chooser for current profile.
325 DownloadTestFileActivityObserver observer(current_browser()->profile()); 325 DownloadTestFileActivityObserver observer(current_browser()->profile());
326 observer.EnableFileChooser(false); 326 observer.EnableFileChooser(false);
327 } 327 }
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 float scale, 615 float scale,
616 IconLoader::IconSize icon_size, 616 IconLoader::IconSize icon_size,
617 IconURLCallback callback) override { 617 IconURLCallback callback) override {
618 EXPECT_STREQ(expected_path_.value().c_str(), path.value().c_str()); 618 EXPECT_STREQ(expected_path_.value().c_str(), path.value().c_str());
619 EXPECT_EQ(expected_icon_size_, icon_size); 619 EXPECT_EQ(expected_icon_size_, icon_size);
620 if (expected_path_ == path && 620 if (expected_path_ == path &&
621 expected_icon_size_ == icon_size) { 621 expected_icon_size_ == icon_size) {
622 callback_ = callback; 622 callback_ = callback;
623 BrowserThread::PostTask( 623 BrowserThread::PostTask(
624 BrowserThread::UI, FROM_HERE, 624 BrowserThread::UI, FROM_HERE,
625 base::Bind(&MockIconExtractorImpl::RunCallback, 625 base::BindOnce(&MockIconExtractorImpl::RunCallback,
626 base::Unretained(this))); 626 base::Unretained(this)));
627 return true; 627 return true;
628 } else { 628 } else {
629 return false; 629 return false;
630 } 630 }
631 } 631 }
632 632
633 private: 633 private:
634 void RunCallback() { 634 void RunCallback() {
635 callback_.Run(response_); 635 callback_.Run(response_);
636 // Drop the reference on extension function to avoid memory leaks. 636 // Drop the reference on extension function to avoid memory leaks.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 base::FilePath temp_file; 699 base::FilePath temp_file;
700 if (!base::CreateTemporaryFile(&temp_file) || 700 if (!base::CreateTemporaryFile(&temp_file) ||
701 base::WriteFile(temp_file, data, length) != length) { 701 base::WriteFile(temp_file, data, length) != length) {
702 return false; 702 return false;
703 } 703 }
704 // Invoke the fileapi to copy it into the sandboxed filesystem. 704 // Invoke the fileapi to copy it into the sandboxed filesystem.
705 bool result = false; 705 bool result = false;
706 base::RunLoop run_loop; 706 base::RunLoop run_loop;
707 BrowserThread::PostTask( 707 BrowserThread::PostTask(
708 BrowserThread::IO, FROM_HERE, 708 BrowserThread::IO, FROM_HERE,
709 base::Bind(&CreateFileForTestingOnIOThread, base::Unretained(context), 709 base::BindOnce(&CreateFileForTestingOnIOThread,
710 path, temp_file, base::Unretained(&result), 710 base::Unretained(context), path, temp_file,
711 run_loop.QuitClosure())); 711 base::Unretained(&result), run_loop.QuitClosure()));
712 // Wait for that to finish. 712 // Wait for that to finish.
713 run_loop.Run(); 713 run_loop.Run();
714 base::DeleteFile(temp_file, false); 714 base::DeleteFile(temp_file, false);
715 return result; 715 return result;
716 } 716 }
717 717
718 private: 718 private:
719 static void CopyInCompletion(bool* result, 719 static void CopyInCompletion(bool* result,
720 const base::Closure& quit_closure, 720 const base::Closure& quit_closure,
721 base::File::Error error) { 721 base::File::Error error) {
(...skipping 3575 matching lines...) Expand 10 before | Expand all | Expand 10 after
4297 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); 4297 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action);
4298 EXPECT_FALSE(warnings.empty()); 4298 EXPECT_FALSE(warnings.empty());
4299 EXPECT_EQ(Warning::kDownloadFilenameConflict, 4299 EXPECT_EQ(Warning::kDownloadFilenameConflict,
4300 warnings.begin()->warning_type()); 4300 warnings.begin()->warning_type());
4301 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); 4301 EXPECT_EQ("incumbent", warnings.begin()->extension_id());
4302 } 4302 }
4303 4303
4304 } // namespace extensions 4304 } // namespace extensions
4305 4305
4306 #endif // http://crbug.com/306144 4306 #endif // http://crbug.com/306144
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698