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

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

Issue 8960010: base::Bind: Convert NewRunnableMethod in chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix 55. Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_service_unittest.h" 5 #include "chrome/browser/extensions/extension_service_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 InitializeEmptyExtensionService(); 2808 InitializeEmptyExtensionService();
2809 InstallCRX(data_dir_.AppendASCII("good.crx"), INSTALL_NEW); 2809 InstallCRX(data_dir_.AppendASCII("good.crx"), INSTALL_NEW);
2810 TerminateExtension(good_crx); 2810 TerminateExtension(good_crx);
2811 UninstallExtension(good_crx, true); 2811 UninstallExtension(good_crx, true);
2812 } 2812 }
2813 2813
2814 class ExtensionCookieCallback { 2814 class ExtensionCookieCallback {
2815 public: 2815 public:
2816 ExtensionCookieCallback() 2816 ExtensionCookieCallback()
2817 : result_(false), 2817 : result_(false),
2818 message_loop_factory_(MessageLoop::current()) {} 2818 weak_factory_(MessageLoop::current()) {}
2819 2819
2820 void SetCookieCallback(bool result) { 2820 void SetCookieCallback(bool result) {
2821 MessageLoop::current()->PostTask( 2821 MessageLoop::current()->PostTask(
2822 FROM_HERE, 2822 FROM_HERE, base::Bind(&MessageLoop::Quit, weak_factory_.GetWeakPtr()));
2823 message_loop_factory_.NewRunnableMethod(&MessageLoop::Quit));
2824 result_ = result; 2823 result_ = result;
2825 } 2824 }
2826 2825
2827 void GetAllCookiesCallback(const net::CookieList& list) { 2826 void GetAllCookiesCallback(const net::CookieList& list) {
2828 MessageLoop::current()->PostTask( 2827 MessageLoop::current()->PostTask(
2829 FROM_HERE, 2828 FROM_HERE, base::Bind(&MessageLoop::Quit, weak_factory_.GetWeakPtr()));
2830 message_loop_factory_.NewRunnableMethod(&MessageLoop::Quit));
2831 list_ = list; 2829 list_ = list;
2832 } 2830 }
2833 net::CookieList list_; 2831 net::CookieList list_;
2834 bool result_; 2832 bool result_;
2835 ScopedRunnableMethodFactory<MessageLoop> message_loop_factory_; 2833 base::WeakPtrFactory<MessageLoop> weak_factory_;
2836 }; 2834 };
2837 2835
2838 // Verifies extension state is removed upon uninstall. 2836 // Verifies extension state is removed upon uninstall.
2839 TEST_F(ExtensionServiceTest, ClearExtensionData) { 2837 TEST_F(ExtensionServiceTest, ClearExtensionData) {
2840 InitializeEmptyExtensionService(); 2838 InitializeEmptyExtensionService();
2841 ExtensionCookieCallback callback; 2839 ExtensionCookieCallback callback;
2842 2840
2843 // Load a test extension. 2841 // Load a test extension.
2844 FilePath path = data_dir_; 2842 FilePath path = data_dir_;
2845 path = path.AppendASCII("good.crx"); 2843 path = path.AppendASCII("good.crx");
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after
4381 ASSERT_FALSE(AddPendingSyncInstall()); 4379 ASSERT_FALSE(AddPendingSyncInstall());
4382 4380
4383 // Wait for the external source to install. 4381 // Wait for the external source to install.
4384 WaitForCrxInstall(crx_path_, INSTALL_NEW); 4382 WaitForCrxInstall(crx_path_, INSTALL_NEW);
4385 ASSERT_TRUE(IsCrxInstalled()); 4383 ASSERT_TRUE(IsCrxInstalled());
4386 4384
4387 // Now that the extension is installed, sync request should fail 4385 // Now that the extension is installed, sync request should fail
4388 // because the extension is already installed. 4386 // because the extension is already installed.
4389 ASSERT_FALSE(AddPendingSyncInstall()); 4387 ASSERT_FALSE(AddPendingSyncInstall());
4390 } 4388 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_page_capture_api.cc ('k') | chrome/browser/history/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698