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

Side by Side Diff: chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_unittest.cc

Issue 2753743005: mediaview: Hack to avoid Files app to freeze soon after login. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.cc ('k') | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <string.h> 5 #include <string.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 watcher_callback, 308 watcher_callback,
309 base::Bind( 309 base::Bind(
310 [](base::RunLoop* run_loop, base::File::Error error) { 310 [](base::RunLoop* run_loop, base::File::Error error) {
311 EXPECT_EQ(base::File::FILE_OK, error); 311 EXPECT_EQ(base::File::FILE_OK, error);
312 run_loop->Quit(); 312 run_loop->Quit();
313 }, 313 },
314 &run_loop)); 314 &run_loop));
315 run_loop.Run(); 315 run_loop.Run();
316 } 316 }
317 317
318 // Even if AddWatcher() returns, the watch may not have started. In order to
319 // make installation finish we run the message loop until idle. This depends
320 // on the behavior of FakeFileSystemInstance.
321 //
322 // TODO(crbug.com/698624): Remove the hack to make AddWatcher() return
323 // immediately.
324 base::RunLoop().RunUntilIdle();
325
318 EXPECT_EQ(0, num_called); 326 EXPECT_EQ(0, num_called);
319 fake_file_system_.TriggerWatchers(kAuthority, kDirSpec.document_id, 327 fake_file_system_.TriggerWatchers(kAuthority, kDirSpec.document_id,
320 mojom::ChangeType::CHANGED); 328 mojom::ChangeType::CHANGED);
321 base::RunLoop().RunUntilIdle(); 329 base::RunLoop().RunUntilIdle();
322 EXPECT_EQ(1, num_called); 330 EXPECT_EQ(1, num_called);
323 331
324 { 332 {
325 base::RunLoop run_loop; 333 base::RunLoop run_loop;
326 root_->RemoveWatcher( 334 root_->RemoveWatcher(
327 base::FilePath(FILE_PATH_LITERAL("dir")), 335 base::FilePath(FILE_PATH_LITERAL("dir")),
(...skipping 22 matching lines...) Expand all
350 watcher_callback, 358 watcher_callback,
351 base::Bind( 359 base::Bind(
352 [](base::RunLoop* run_loop, base::File::Error error) { 360 [](base::RunLoop* run_loop, base::File::Error error) {
353 EXPECT_EQ(base::File::FILE_OK, error); 361 EXPECT_EQ(base::File::FILE_OK, error);
354 run_loop->Quit(); 362 run_loop->Quit();
355 }, 363 },
356 &run_loop)); 364 &run_loop));
357 run_loop.Run(); 365 run_loop.Run();
358 } 366 }
359 367
368 // Even if AddWatcher() returns, the watch may not have started. In order to
369 // make installation finish we run the message loop until idle. This depends
370 // on the behavior of FakeFileSystemInstance.
371 //
372 // TODO(crbug.com/698624): Remove the hack to make AddWatcher() return
373 // immediately.
374 base::RunLoop().RunUntilIdle();
375
360 EXPECT_EQ(0, num_called); 376 EXPECT_EQ(0, num_called);
361 fake_file_system_.TriggerWatchers(kAuthority, kDirSpec.document_id, 377 fake_file_system_.TriggerWatchers(kAuthority, kDirSpec.document_id,
362 mojom::ChangeType::DELETED); 378 mojom::ChangeType::DELETED);
363 base::RunLoop().RunUntilIdle(); 379 base::RunLoop().RunUntilIdle();
364 EXPECT_EQ(1, num_called); 380 EXPECT_EQ(1, num_called);
365 381
366 // Even if the watched file was deleted, the watcher is still alive and we 382 // Even if the watched file was deleted, the watcher is still alive and we
367 // should clean it up. 383 // should clean it up.
368 { 384 {
369 base::RunLoop run_loop; 385 base::RunLoop run_loop;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 [](base::RunLoop* run_loop, const GURL& url) { 445 [](base::RunLoop* run_loop, const GURL& url) {
430 EXPECT_EQ(GURL("content://org.chromium.test/document/dup3-id"), 446 EXPECT_EQ(GURL("content://org.chromium.test/document/dup3-id"),
431 url); 447 url);
432 run_loop->Quit(); 448 run_loop->Quit();
433 }, 449 },
434 &run_loop)); 450 &run_loop));
435 run_loop.Run(); 451 run_loop.Run();
436 } 452 }
437 453
438 } // namespace arc 454 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698