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

Side by Side Diff: chrome/browser/chromeos/drive/search_metadata_unittest.cc

Issue 12706012: chromeos: Destruct DriveResourceMetadata on the blocking pool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add note Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/drive/search_metadata.h" 5 #include "chrome/browser/chromeos/drive/search_metadata.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/threading/sequenced_worker_pool.h" 9 #include "base/threading/sequenced_worker_pool.h"
10 #include "chrome/browser/chromeos/drive/drive_cache.h" 10 #include "chrome/browser/chromeos/drive/drive_cache.h"
(...skipping 30 matching lines...) Expand all
41 41
42 fake_drive_service_.reset(new google_apis::FakeDriveService); 42 fake_drive_service_.reset(new google_apis::FakeDriveService);
43 fake_drive_service_->LoadResourceListForWapi( 43 fake_drive_service_->LoadResourceListForWapi(
44 "chromeos/gdata/root_feed.json"); 44 "chromeos/gdata/root_feed.json");
45 fake_drive_service_->LoadAccountMetadataForWapi( 45 fake_drive_service_->LoadAccountMetadataForWapi(
46 "chromeos/gdata/account_metadata.json"); 46 "chromeos/gdata/account_metadata.json");
47 fake_drive_service_->LoadAppListForDriveApi("chromeos/drive/applist.json"); 47 fake_drive_service_->LoadAppListForDriveApi("chromeos/drive/applist.json");
48 48
49 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); 49 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter);
50 50
51 drive_cache_ = new DriveCache( 51 drive_cache_.reset(new DriveCache(
52 DriveCache::GetCacheRootPath(profile_.get()), 52 DriveCache::GetCacheRootPath(profile_.get()),
53 blocking_task_runner_, 53 blocking_task_runner_,
54 fake_free_disk_space_getter_.get()); 54 fake_free_disk_space_getter_.get()));
55 55
56 drive_webapps_registry_.reset(new DriveWebAppsRegistry); 56 drive_webapps_registry_.reset(new DriveWebAppsRegistry);
57 57
58 file_system_.reset(new DriveFileSystem(profile_.get(), 58 file_system_.reset(new DriveFileSystem(profile_.get(),
59 drive_cache_, 59 drive_cache_.get(),
60 fake_drive_service_.get(), 60 fake_drive_service_.get(),
61 NULL, // uploader 61 NULL, // uploader
62 drive_webapps_registry_.get(), 62 drive_webapps_registry_.get(),
63 blocking_task_runner_)); 63 blocking_task_runner_));
64 file_system_->Initialize(); 64 file_system_->Initialize();
65 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 65 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
66 file_system_->change_list_loader()->LoadFromServerIfNeeded( 66 file_system_->change_list_loader()->LoadFromServerIfNeeded(
67 DirectoryFetchInfo(), 67 DirectoryFetchInfo(),
68 base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, 68 base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback,
69 &error)); 69 &error));
70 google_apis::test_util::RunBlockingPoolTask(); 70 google_apis::test_util::RunBlockingPoolTask();
71 ASSERT_EQ(DRIVE_FILE_OK, error); 71 ASSERT_EQ(DRIVE_FILE_OK, error);
72 } 72 }
73 73
74 virtual void TearDown() OVERRIDE { 74 virtual void TearDown() OVERRIDE {
75 test_util::DeleteDriveCache(drive_cache_); 75 drive_cache_.reset();
76 } 76 }
77 77
78 protected: 78 protected:
79 MessageLoopForUI message_loop_; 79 MessageLoopForUI message_loop_;
80 content::TestBrowserThread ui_thread_; 80 content::TestBrowserThread ui_thread_;
81 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 81 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
82 scoped_ptr<TestingProfile> profile_; 82 scoped_ptr<TestingProfile> profile_;
83 scoped_ptr<google_apis::FakeDriveService> fake_drive_service_; 83 scoped_ptr<google_apis::FakeDriveService> fake_drive_service_;
84 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; 84 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_;
85 DriveCache* drive_cache_; 85 scoped_ptr<DriveCache, test_util::DestroyHelperForTests> drive_cache_;
86 scoped_ptr<DriveWebAppsRegistry> drive_webapps_registry_; 86 scoped_ptr<DriveWebAppsRegistry> drive_webapps_registry_;
87 scoped_ptr<DriveFileSystem> file_system_; 87 scoped_ptr<DriveFileSystem> file_system_;
88 }; 88 };
89 89
90 TEST_F(SearchMetadataTest, SearchMetadata_ZeroMatches) { 90 TEST_F(SearchMetadataTest, SearchMetadata_ZeroMatches) {
91 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 91 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
92 scoped_ptr<MetadataSearchResultVector> result; 92 scoped_ptr<MetadataSearchResultVector> result;
93 93
94 SearchMetadata(file_system_.get(), 94 SearchMetadata(file_system_.get(),
95 "NonExistent", 95 "NonExistent",
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 EXPECT_EQ("&lt;<b>hello</b>&gt;", highlighted_text); 315 EXPECT_EQ("&lt;<b>hello</b>&gt;", highlighted_text);
316 } 316 }
317 317
318 TEST(SearchMetadataSimpleTest, FindAndHighlight_MoreMetaChars) { 318 TEST(SearchMetadataSimpleTest, FindAndHighlight_MoreMetaChars) {
319 std::string highlighted_text; 319 std::string highlighted_text;
320 EXPECT_TRUE(FindAndHighlight("a&b&c&d", "b&c", &highlighted_text)); 320 EXPECT_TRUE(FindAndHighlight("a&b&c&d", "b&c", &highlighted_text));
321 EXPECT_EQ("a&amp;<b>b&amp;c</b>&amp;d", highlighted_text); 321 EXPECT_EQ("a&amp;<b>b&amp;c</b>&amp;d", highlighted_text);
322 } 322 }
323 323
324 } // namespace drive 324 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698