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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc

Issue 693123002: Fixed memory leak of FileManagerPrivateApiTest.OnFileChanged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "base/stl_util.h" 6 #include "base/stl_util.h"
7 #include "chrome/browser/chromeos/drive/file_change.h" 7 #include "chrome/browser/chromeos/drive/file_change.h"
8 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" 8 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h"
9 #include "chrome/browser/chromeos/file_manager/drive_test_util.h" 9 #include "chrome/browser/chromeos/file_manager/drive_test_util.h"
10 #include "chrome/browser/chromeos/file_manager/file_watcher.h" 10 #include "chrome/browser/chromeos/file_manager/file_watcher.h"
11 #include "chrome/browser/extensions/extension_apitest.h" 11 #include "chrome/browser/extensions/extension_apitest.h"
12 #include "chrome/test/base/testing_profile.h" 12 #include "chrome/test/base/testing_profile.h"
13 #include "chrome/test/base/ui_test_utils.h"
13 #include "chromeos/dbus/cros_disks_client.h" 14 #include "chromeos/dbus/cros_disks_client.h"
14 #include "chromeos/disks/mock_disk_mount_manager.h" 15 #include "chromeos/disks/mock_disk_mount_manager.h"
15 #include "extensions/common/extension.h" 16 #include "extensions/common/extension.h"
16 #include "extensions/common/install_warning.h" 17 #include "extensions/common/install_warning.h"
17 18
18 using ::testing::_; 19 using ::testing::_;
19 using ::testing::ReturnRef; 20 using ::testing::ReturnRef;
20 21
21 using chromeos::disks::DiskMountManager; 22 using chromeos::disks::DiskMountManager;
22 23
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/a/d/e")), 332 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/a/d/e")),
332 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs-hash/root/a/d/e")), 333 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs-hash/root/a/d/e")),
333 "extension_2", base::Bind(&AddFileWatchCallback)); 334 "extension_2", base::Bind(&AddFileWatchCallback));
334 335
335 event_router_->AddFileWatch( 336 event_router_->AddFileWatch(
336 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/aaa")), 337 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/aaa")),
337 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs-hash/root/aaa")), 338 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs-hash/root/aaa")),
338 "extension_3", base::Bind(&AddFileWatchCallback)); 339 "extension_3", base::Bind(&AddFileWatchCallback));
339 340
340 // event_router->addFileWatch create some tasks which are performed on message 341 // event_router->addFileWatch create some tasks which are performed on message
341 // loop. Wait until they are done. 342 // loop of BrowserThread::FILE. Wait until they are done.
342 base::RunLoop().RunUntilIdle(); 343 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
mtomasz 2014/10/31 05:29:29 Hm. Shall we also wait on the UI message loop? We
yawano 2014/10/31 05:39:51 Yes, it can make the test more stable. I added a c
343 344
344 // When /a is deleted (1 and 2 is notified). 345 // When /a is deleted (1 and 2 is notified).
345 FileChange first_change; 346 FileChange first_change;
346 first_change.Update( 347 first_change.Update(
347 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/a")), 348 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/a")),
348 FileType::FILE_TYPE_DIRECTORY, ChangeType::DELETE); 349 FileType::FILE_TYPE_DIRECTORY, ChangeType::DELETE);
349 event_router_->OnFileChanged(first_change); 350 event_router_->OnFileChanged(first_change);
350 EXPECT_EQ(2, counter); 351 EXPECT_EQ(2, counter);
351 352
352 // When /a/b/c is deleted (1 is notified). 353 // When /a/b/c is deleted (1 is notified).
(...skipping 17 matching lines...) Expand all
370 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/a/b/c")), 371 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/a/b/c")),
371 "extension_1"); 372 "extension_1");
372 event_router_->RemoveFileWatch( 373 event_router_->RemoveFileWatch(
373 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/a/d/e")), 374 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/a/d/e")),
374 "extension_2"); 375 "extension_2");
375 event_router_->RemoveFileWatch( 376 event_router_->RemoveFileWatch(
376 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/aaa")), 377 base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/aaa")),
377 "extension_3"); 378 "extension_3");
378 379
379 // event_router->removeFileWatch create some tasks which are performed on 380 // event_router->removeFileWatch create some tasks which are performed on
380 // message loop. wait until they are done. 381 // message loop of BrowserThread::FILE. Wait until they are done.
381 base::RunLoop().RunUntilIdle(); 382 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
382 } 383 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698