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

Side by Side Diff: chrome/browser/history/history_unittest.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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) 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 // History unit tests come in two flavors: 5 // History unit tests come in two flavors:
6 // 6 //
7 // 1. The more complicated style is that the unit test creates a full history 7 // 1. The more complicated style is that the unit test creates a full history
8 // service. This spawns a background thread for the history backend, and 8 // service. This spawns a background thread for the history backend, and
9 // all communication is asynchronous. This is useful for testing more 9 // all communication is asynchronous. This is useful for testing more
10 // complicated things or end-to-end behavior. 10 // complicated things or end-to-end behavior.
(...skipping 11 matching lines...) Expand all
22 #include <algorithm> 22 #include <algorithm>
23 #include <string> 23 #include <string>
24 24
25 #include "base/basictypes.h" 25 #include "base/basictypes.h"
26 #include "base/bind.h" 26 #include "base/bind.h"
27 #include "base/bind_helpers.h" 27 #include "base/bind_helpers.h"
28 #include "base/callback.h" 28 #include "base/callback.h"
29 #include "base/command_line.h" 29 #include "base/command_line.h"
30 #include "base/file_path.h" 30 #include "base/file_path.h"
31 #include "base/file_util.h" 31 #include "base/file_util.h"
32 #include "base/files/scoped_temp_dir.h"
32 #include "base/memory/scoped_vector.h" 33 #include "base/memory/scoped_vector.h"
33 #include "base/message_loop.h" 34 #include "base/message_loop.h"
34 #include "base/path_service.h" 35 #include "base/path_service.h"
35 #include "base/scoped_temp_dir.h"
36 #include "base/string_util.h" 36 #include "base/string_util.h"
37 #include "base/time.h" 37 #include "base/time.h"
38 #include "base/utf_string_conversions.h" 38 #include "base/utf_string_conversions.h"
39 #include "chrome/browser/history/history.h" 39 #include "chrome/browser/history/history.h"
40 #include "chrome/browser/history/history_backend.h" 40 #include "chrome/browser/history/history_backend.h"
41 #include "chrome/browser/history/history_database.h" 41 #include "chrome/browser/history/history_database.h"
42 #include "chrome/browser/history/history_notifications.h" 42 #include "chrome/browser/history/history_notifications.h"
43 #include "chrome/browser/history/in_memory_database.h" 43 #include "chrome/browser/history/in_memory_database.h"
44 #include "chrome/browser/history/in_memory_history_backend.h" 44 #include "chrome/browser/history/in_memory_history_backend.h"
45 #include "chrome/browser/history/page_usage_data.h" 45 #include "chrome/browser/history/page_usage_data.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 time, 144 time,
145 time, 145 time,
146 0, 146 0,
147 512, 147 512,
148 state, 148 state,
149 0, 149 0,
150 0); 150 0);
151 return db_->CreateDownload(download); 151 return db_->CreateDownload(download);
152 } 152 }
153 153
154 ScopedTempDir temp_dir_; 154 base::ScopedTempDir temp_dir_;
155 155
156 MessageLoopForUI message_loop_; 156 MessageLoopForUI message_loop_;
157 157
158 // names of the database files 158 // names of the database files
159 FilePath history_dir_; 159 FilePath history_dir_;
160 160
161 // Created via CreateBackendAndDatabase. 161 // Created via CreateBackendAndDatabase.
162 scoped_refptr<HistoryBackend> backend_; 162 scoped_refptr<HistoryBackend> backend_;
163 scoped_ptr<InMemoryHistoryBackend> in_mem_backend_; 163 scoped_ptr<InMemoryHistoryBackend> in_mem_backend_;
164 HistoryDatabase* db_; // Cached reference to the backend's database. 164 HistoryDatabase* db_; // Cached reference to the backend's database.
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 bool success, 463 bool success,
464 history::RedirectList* redirects) { 464 history::RedirectList* redirects) {
465 redirect_query_success_ = success; 465 redirect_query_success_ = success;
466 if (redirect_query_success_) 466 if (redirect_query_success_)
467 saved_redirects_.swap(*redirects); 467 saved_redirects_.swap(*redirects);
468 else 468 else
469 saved_redirects_.clear(); 469 saved_redirects_.clear();
470 MessageLoop::current()->Quit(); 470 MessageLoop::current()->Quit();
471 } 471 }
472 472
473 ScopedTempDir temp_dir_; 473 base::ScopedTempDir temp_dir_;
474 474
475 MessageLoopForUI message_loop_; 475 MessageLoopForUI message_loop_;
476 476
477 // PageUsageData vector to test segments. 477 // PageUsageData vector to test segments.
478 ScopedVector<PageUsageData> page_usage_data_; 478 ScopedVector<PageUsageData> page_usage_data_;
479 479
480 MostVisitedURLList most_visited_urls_; 480 MostVisitedURLList most_visited_urls_;
481 481
482 // When non-NULL, this will be deleted on tear down and we will block until 482 // When non-NULL, this will be deleted on tear down and we will block until
483 // the backend thread has completed. This allows tests for the history 483 // the backend thread has completed. This allows tests for the history
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 request_consumer.CancelAllRequests(); 1032 request_consumer.CancelAllRequests();
1033 CleanupHistoryService(); 1033 CleanupHistoryService();
1034 // WARNING: history has now been deleted. 1034 // WARNING: history has now been deleted.
1035 history_service_.reset(); 1035 history_service_.reset();
1036 ASSERT_FALSE(task->done_invoked); 1036 ASSERT_FALSE(task->done_invoked);
1037 } 1037 }
1038 1038
1039 } // namespace 1039 } // namespace
1040 1040
1041 } // namespace history 1041 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_querying_unittest.cc ('k') | chrome/browser/history/in_memory_url_index_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698