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

Side by Side Diff: chrome/browser/importer/importer_unittest.cc

Issue 3581008: Fix instances of passing raw pointers to RefCounted objects in tasks. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Merge Created 10 years, 2 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 MessageLoop* loop = MessageLoop::current(); 113 MessageLoop* loop = MessageLoop::current();
114 ProfileInfo profile_info; 114 ProfileInfo profile_info;
115 profile_info.browser_type = FIREFOX3; 115 profile_info.browser_type = FIREFOX3;
116 profile_info.app_path = app_path_; 116 profile_info.app_path = app_path_;
117 profile_info.source_path = profile_path_; 117 profile_info.source_path = profile_path_;
118 scoped_refptr<ImporterHost> host = new ImporterHost(); 118 scoped_refptr<ImporterHost> host = new ImporterHost();
119 host->SetObserver(observer); 119 host->SetObserver(observer);
120 int items = HISTORY | PASSWORDS | FAVORITES; 120 int items = HISTORY | PASSWORDS | FAVORITES;
121 if (import_search_plugins) 121 if (import_search_plugins)
122 items = items | SEARCH_ENGINES; 122 items = items | SEARCH_ENGINES;
123 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), 123 loop->PostTask(
124 &ImporterHost::StartImportSettings, profile_info, 124 FROM_HERE,
125 static_cast<Profile*>(NULL), items, writer, true)); 125 NewRunnableMethod(host.get(),
126 &ImporterHost::StartImportSettings,
127 profile_info,
128 static_cast<Profile*>(NULL),
129 items,
130 make_scoped_refptr(writer),
131 true));
126 loop->Run(); 132 loop->Run();
127 } 133 }
128 134
129 MessageLoopForUI message_loop_; 135 MessageLoopForUI message_loop_;
130 ChromeThread ui_thread_; 136 ChromeThread ui_thread_;
131 ChromeThread file_thread_; 137 ChromeThread file_thread_;
132 FilePath test_path_; 138 FilePath test_path_;
133 FilePath profile_path_; 139 FilePath profile_path_;
134 FilePath app_path_; 140 FilePath app_path_;
135 }; 141 };
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 data_path = data_path.AppendASCII("firefox2_searchplugins"); 697 data_path = data_path.AppendASCII("firefox2_searchplugins");
692 if (!file_util::PathExists(data_path)) { 698 if (!file_util::PathExists(data_path)) {
693 // TODO(maruel): Create test data that we can open source! 699 // TODO(maruel): Create test data that we can open source!
694 LOG(ERROR) << L"Missing internal test data"; 700 LOG(ERROR) << L"Missing internal test data";
695 return; 701 return;
696 } 702 }
697 ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false)); 703 ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false));
698 704
699 MessageLoop* loop = MessageLoop::current(); 705 MessageLoop* loop = MessageLoop::current();
700 scoped_refptr<ImporterHost> host = new ImporterHost(); 706 scoped_refptr<ImporterHost> host = new ImporterHost();
701 FirefoxObserver* observer = new FirefoxObserver(); 707 scoped_refptr<FirefoxObserver> observer = new FirefoxObserver();
702 host->SetObserver(observer); 708 host->SetObserver(observer);
703 ProfileInfo profile_info; 709 ProfileInfo profile_info;
704 profile_info.browser_type = FIREFOX2; 710 profile_info.browser_type = FIREFOX2;
705 profile_info.app_path = app_path_; 711 profile_info.app_path = app_path_;
706 profile_info.source_path = profile_path_; 712 profile_info.source_path = profile_path_;
707 713
708 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), 714 loop->PostTask(
709 &ImporterHost::StartImportSettings, profile_info, 715 FROM_HERE,
710 static_cast<Profile*>(NULL), 716 NewRunnableMethod(
711 HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, observer, true)); 717 host.get(),
718 &ImporterHost::StartImportSettings,
719 profile_info,
720 static_cast<Profile*>(NULL),
721 HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES,
722 observer,
723 true));
712 loop->Run(); 724 loop->Run();
713 } 725 }
714 726
715 static const BookmarkList kFirefox3Bookmarks[] = { 727 static const BookmarkList kFirefox3Bookmarks[] = {
716 {true, 0, {}, 728 {true, 0, {},
717 L"Toolbar", 729 L"Toolbar",
718 "http://site/"}, 730 "http://site/"},
719 {false, 0, {}, 731 {false, 0, {},
720 L"Title", 732 L"Title",
721 "http://www.google.com/"}, 733 "http://www.google.com/"},
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 true); 897 true);
886 } 898 }
887 899
888 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { 900 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) {
889 bool import_search_engines = false; 901 bool import_search_engines = false;
890 scoped_refptr<Firefox3Observer> observer = 902 scoped_refptr<Firefox3Observer> observer =
891 new Firefox3Observer(import_search_engines); 903 new Firefox3Observer(import_search_engines);
892 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), 904 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(),
893 import_search_engines); 905 import_search_engines);
894 } 906 }
OLDNEW
« no previous file with comments | « chrome/browser/download/save_package.cc ('k') | chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698