1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <vector>
6
7#include "chrome/browser/ui/browser.h"
8#include "chrome/browser/ui/tabs/tab_strip_model.h"
9#include "chrome/test/base/in_process_browser_test.h"
10#include "chrome/test/base/ui_test_utils.h"
11#include "content/public/browser/web_contents.h"
12#include "content/public/test/browser_test_utils.h"
13
14class FileManagerJsTest : public InProcessBrowserTest {
15 public:
16  // Runs all test functions in |file|, waiting for them to complete.
17  void RunTest(const base::FilePath& file) {
18    GURL url = ui_test_utils::GetTestUrl(
19        base::FilePath(FILE_PATH_LITERAL("file_manager/unit_tests")), file);
20    ui_test_utils::NavigateToURL(browser(), url);
21
22    content::WebContents* web_contents =
23        browser()->tab_strip_model()->GetActiveWebContents();
24    ASSERT_TRUE(web_contents);
25
26    const std::vector<int> empty_libraries;
27    EXPECT_TRUE(ExecuteWebUIResourceTest(web_contents, empty_libraries));
28  }
29};
30
31IN_PROC_BROWSER_TEST_F(
32    FileManagerJsTest, NavigationListModelTest) {
33  RunTest(base::FilePath(
34      FILE_PATH_LITERAL("navigation_list_model_unittest.html")));
35}
36
37IN_PROC_BROWSER_TEST_F(
38    FileManagerJsTest, FileOperationHandlerTest) {
39  RunTest(base::FilePath(
40      FILE_PATH_LITERAL("file_operation_handler_unittest.html")));
41}
42
43IN_PROC_BROWSER_TEST_F(
44    FileManagerJsTest, ProgressCenterItemGroupTest) {
45  RunTest(base::FilePath(
46      FILE_PATH_LITERAL("progress_center_item_group_unittest.html")));
47}
48
49IN_PROC_BROWSER_TEST_F(
50    FileManagerJsTest, DeviceHandlerTest) {
51  RunTest(base::FilePath(FILE_PATH_LITERAL("device_handler_unittest.html")));
52}
53
54IN_PROC_BROWSER_TEST_F(
55    FileManagerJsTest, MetadataCacheTest) {
56  RunTest(base::FilePath(FILE_PATH_LITERAL("metadata_cache_unittest.html")));
57}
58
59IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FileOperationManagerTest) {
60  RunTest(base::FilePath(
61      FILE_PATH_LITERAL("file_operation_manager_unittest.html")));
62}
63