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

Unified Diff: chrome/browser/chromeos/file_manager/drive_test_util.cc

Issue 1208963003: Move GN obj files to target-specific dirs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: \ Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_manager/drive_test_util.cc
diff --git a/chrome/browser/chromeos/file_manager/drive_test_util.cc b/chrome/browser/chromeos/file_manager/drive_test_util.cc
deleted file mode 100644
index 89af97e0af24c6ae83113a1249f5222700759d9f..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/file_manager/drive_test_util.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/file_manager/drive_test_util.h"
-
-#include "base/run_loop.h"
-#include "chrome/browser/chromeos/drive/drive_integration_service.h"
-
-namespace file_manager {
-namespace test_util {
-
-namespace {
-
-// Helper class used to wait for |OnFileSystemMounted| event from a drive file
-// system.
-class DriveMountPointWaiter : public drive::DriveIntegrationServiceObserver {
- public:
- explicit DriveMountPointWaiter(
- drive::DriveIntegrationService* integration_service)
- : integration_service_(integration_service) {
- integration_service_->AddObserver(this);
- }
-
- ~DriveMountPointWaiter() override {
- integration_service_->RemoveObserver(this);
- }
-
- // DriveIntegrationServiceObserver override.
- void OnFileSystemMounted() override {
- // Note that it is OK for |run_loop_.Quit| to be called before
- // |run_loop_.Run|. In this case |Run| will return immediately.
- run_loop_.Quit();
- }
-
- // Runs loop until the file system is mounted.
- void Wait() {
- run_loop_.Run();
- }
-
- private:
- drive::DriveIntegrationService* integration_service_;
- base::RunLoop run_loop_;
-};
-
-} // namespace
-
-void WaitUntilDriveMountPointIsAdded(Profile* profile) {
- DCHECK(profile);
-
- // Drive mount point is added by the browser when the drive system service
- // is first initialized. It is done asynchronously after some other parts of
- // the service are initialized (e.g. resource metadata and cache), thus racy
- // with the test start. To handle this raciness, the test verifies that
- // drive mount point is added before continuing. If this is not the case,
- // drive file system is observed for FileSystemMounted event (by
- // |mount_point_waiter|) and test continues once the event is encountered.
- drive::DriveIntegrationService* integration_service =
- drive::DriveIntegrationServiceFactory::FindForProfile(profile);
- DCHECK(integration_service);
- DCHECK(integration_service->is_enabled());
-
- if (integration_service->IsMounted())
- return;
-
- DriveMountPointWaiter mount_point_waiter(integration_service);
- VLOG(1) << "Waiting for drive mount point to get mounted.";
- mount_point_waiter.Wait();
- VLOG(1) << "Drive mount point found.";
-}
-
-} // namespace test_util
-} // namespace file_manager

Powered by Google App Engine
This is Rietveld 408576698