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

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

Issue 2965903002: Revert of file_manager: Migrate FILE thread to TaskScheduler (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc » ('j') | 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 // File contains browser tests for the fileBrowserHandler api. 5 // File contains browser tests for the fileBrowserHandler api.
6 6
7 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handler_a pi.h" 7 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handler_a pi.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/task_scheduler/post_task.h"
17 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
18 #include "base/values.h" 17 #include "base/values.h"
19 #include "chrome/browser/extensions/extension_apitest.h" 18 #include "chrome/browser/extensions/extension_apitest.h"
20 #include "chrome/browser/extensions/extension_function_test_utils.h" 19 #include "chrome/browser/extensions/extension_function_test_utils.h"
21 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
23 #include "chrome/test/base/in_process_browser_test.h" 22 #include "chrome/test/base/in_process_browser_test.h"
24 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
25 #include "content/public/browser/browser_context.h" 24 #include "content/public/browser/browser_context.h"
26 #include "extensions/browser/api_test_utils.h" 25 #include "extensions/browser/api_test_utils.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 ui_test_utils::NavigateToURL(browser(), url); 293 ui_test_utils::NavigateToURL(browser(), url);
295 294
296 ASSERT_TRUE(catcher.GetNextResult()) << message_; 295 ASSERT_TRUE(catcher.GetNextResult()) << message_;
297 296
298 // Selected path should have been created by the test extension after the 297 // Selected path should have been created by the test extension after the
299 // extension function call. 298 // extension function call.
300 ASSERT_TRUE(base::PathExists(selected_path)); 299 ASSERT_TRUE(base::PathExists(selected_path));
301 300
302 // Let's check that the file has the expected content. 301 // Let's check that the file has the expected content.
303 const std::string expected_contents = "hello from test extension."; 302 const std::string expected_contents = "hello from test extension.";
304 base::PostTaskWithTraits(FROM_HERE, 303 content::BrowserThread::PostTask(
305 {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, 304 content::BrowserThread::FILE, FROM_HERE,
306 base::BindOnce(&ExpectFileContentEquals, 305 base::BindOnce(&ExpectFileContentEquals, selected_path,
307 selected_path, expected_contents)); 306 expected_contents));
308 307
309 // Make sure test doesn't finish until we check on file thread that the 308 // Make sure test doesn't finish until we check on file thread that the
310 // selected file's content is as expected. 309 // selected file's content is as expected.
311 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); 310 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
312 311
313 SetTestCases(NULL); 312 SetTestCases(NULL);
314 } 313 }
315 314
316 // Tests that verifies the fileBrowserHandlerInternal.selectFile function fails 315 // Tests that verifies the fileBrowserHandlerInternal.selectFile function fails
317 // when invoked without user gesture. 316 // when invoked without user gesture.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 select_file_function.get(), 382 select_file_function.get(),
384 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]", 383 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]",
385 browser()))); 384 browser())));
386 385
387 EXPECT_FALSE(extensions::api_test_utils::GetBoolean(result.get(), "success")); 386 EXPECT_FALSE(extensions::api_test_utils::GetBoolean(result.get(), "success"));
388 base::DictionaryValue* entry_info; 387 base::DictionaryValue* entry_info;
389 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); 388 EXPECT_FALSE(result->GetDictionary("entry", &entry_info));
390 } 389 }
391 390
392 } // namespace 391 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698