Commit 4e5ecdce authored by Kevin Marshall's avatar Kevin Marshall Committed by Commit Bot

Fix threading bug in RemovableStorageProvider test path

Fix threading bug in RemovableStorageProvider test path
RemovableStorageProvider replies to GetAllDevices() queries on the
FILE thread instead of the caller's thread for test cases.

This fixes the issue by posting the reply to the correct thread.

(Caught by the stricter WeakPtr impl; see CL 2908073007)


R=sky@chromium.org
CC=wez@chromium.org

Bug: 729716
Change-Id: Ie0983e03ba91c8c09ba339ea6c7061de28e69030
Reviewed-on: https://chromium-review.googlesource.com/529864Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488346}
parent d6e3b19d
......@@ -3,8 +3,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/lazy_instance.h"
#include "chrome/browser/extensions/api/image_writer_private/removable_storage_provider.h"
#include "base/lazy_instance.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/browser_thread.h"
namespace extensions {
......@@ -17,10 +18,10 @@ static base::LazyInstance<scoped_refptr<StorageDeviceList>>::DestructorAtExit
// https://code.google.com/p/chromium/issues/detail?id=284898
void RemovableStorageProvider::GetAllDevices(DeviceListReadyCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (g_test_device_list.Get().get() != NULL) {
content::BrowserThread::PostTask(
content::BrowserThread::FILE, FROM_HERE,
base::BindOnce(callback, g_test_device_list.Get(), true));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(callback, g_test_device_list.Get(), true));
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment