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

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

Issue 2966713002: file_manager: Migrate FILE thread to TaskScheduler (Closed)
Patch Set: fix unit test 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"
16 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
17 #include "base/values.h" 18 #include "base/values.h"
18 #include "chrome/browser/extensions/extension_apitest.h" 19 #include "chrome/browser/extensions/extension_apitest.h"
19 #include "chrome/browser/extensions/extension_function_test_utils.h" 20 #include "chrome/browser/extensions/extension_function_test_utils.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
22 #include "chrome/test/base/in_process_browser_test.h" 23 #include "chrome/test/base/in_process_browser_test.h"
23 #include "chrome/test/base/ui_test_utils.h" 24 #include "chrome/test/base/ui_test_utils.h"
24 #include "content/public/browser/browser_context.h" 25 #include "content/public/browser/browser_context.h"
25 #include "extensions/browser/api_test_utils.h" 26 #include "extensions/browser/api_test_utils.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 ui_test_utils::NavigateToURL(browser(), url); 294 ui_test_utils::NavigateToURL(browser(), url);
294 295
295 ASSERT_TRUE(catcher.GetNextResult()) << message_; 296 ASSERT_TRUE(catcher.GetNextResult()) << message_;
296 297
297 // Selected path should have been created by the test extension after the 298 // Selected path should have been created by the test extension after the
298 // extension function call. 299 // extension function call.
299 ASSERT_TRUE(base::PathExists(selected_path)); 300 ASSERT_TRUE(base::PathExists(selected_path));
300 301
301 // Let's check that the file has the expected content. 302 // Let's check that the file has the expected content.
302 const std::string expected_contents = "hello from test extension."; 303 const std::string expected_contents = "hello from test extension.";
303 content::BrowserThread::PostTask( 304 base::PostTaskWithTraits(FROM_HERE,
304 content::BrowserThread::FILE, FROM_HERE, 305 {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
305 base::BindOnce(&ExpectFileContentEquals, selected_path, 306 base::BindOnce(&ExpectFileContentEquals,
306 expected_contents)); 307 selected_path, expected_contents));
307 308
308 // Make sure test doesn't finish until we check on file thread that the 309 // Make sure test doesn't finish until we check on file thread that the
309 // selected file's content is as expected. 310 // selected file's content is as expected.
310 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); 311 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
311 312
312 SetTestCases(NULL); 313 SetTestCases(NULL);
313 } 314 }
314 315
315 // Tests that verifies the fileBrowserHandlerInternal.selectFile function fails 316 // Tests that verifies the fileBrowserHandlerInternal.selectFile function fails
316 // when invoked without user gesture. 317 // when invoked without user gesture.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 select_file_function.get(), 383 select_file_function.get(),
383 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]", 384 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]",
384 browser()))); 385 browser())));
385 386
386 EXPECT_FALSE(extensions::api_test_utils::GetBoolean(result.get(), "success")); 387 EXPECT_FALSE(extensions::api_test_utils::GetBoolean(result.get(), "success"));
387 base::DictionaryValue* entry_info; 388 base::DictionaryValue* entry_info;
388 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); 389 EXPECT_FALSE(result->GetDictionary("entry", &entry_info));
389 } 390 }
390 391
391 } // namespace 392 } // 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