OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/test/remoting/qunit_browser_test_runner.h" | 5 #include "chrome/test/remoting/qunit_browser_test_runner.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/threading/thread_restrictions.h" |
9 #include "base/values.h" | 10 #include "base/values.h" |
10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
13 #include "content/public/test/browser_test_utils.h" | 14 #include "content/public/test/browser_test_utils.h" |
14 #include "net/base/filename_util.h" | 15 #include "net/base/filename_util.h" |
15 | 16 |
16 void QUnitBrowserTestRunner::QUnitStart(content::WebContents* web_contents) { | 17 void QUnitBrowserTestRunner::QUnitStart(content::WebContents* web_contents) { |
17 std::string result; | 18 std::string result; |
18 | 19 |
(...skipping 13 matching lines...) Expand all Loading... |
32 // Extract the fields. | 33 // Extract the fields. |
33 bool passed; | 34 bool passed; |
34 ASSERT_TRUE(dict_value->GetBoolean("passed", &passed)); | 35 ASSERT_TRUE(dict_value->GetBoolean("passed", &passed)); |
35 std::string error_message; | 36 std::string error_message; |
36 ASSERT_TRUE(dict_value->GetString("errorMessage", &error_message)); | 37 ASSERT_TRUE(dict_value->GetString("errorMessage", &error_message)); |
37 | 38 |
38 EXPECT_TRUE(passed) << error_message; | 39 EXPECT_TRUE(passed) << error_message; |
39 } | 40 } |
40 | 41 |
41 void QUnitBrowserTestRunner::RunTest(const base::FilePath& file) { | 42 void QUnitBrowserTestRunner::RunTest(const base::FilePath& file) { |
42 ASSERT_TRUE(PathExists(file)) << "Error: The QUnit test suite <" | 43 { |
43 << file.value() << "> does not exist."; | 44 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 45 ASSERT_TRUE(PathExists(file)) << "Error: The QUnit test suite <" |
| 46 << file.value() << "> does not exist."; |
| 47 } |
44 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(file)); | 48 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(file)); |
45 | 49 |
46 content::WebContents* web_contents = | 50 content::WebContents* web_contents = |
47 browser()->tab_strip_model()->GetActiveWebContents(); | 51 browser()->tab_strip_model()->GetActiveWebContents(); |
48 ASSERT_TRUE(web_contents); | 52 ASSERT_TRUE(web_contents); |
49 | 53 |
50 std::string result; | 54 std::string result; |
51 QUnitStart(web_contents); | 55 QUnitStart(web_contents); |
52 } | 56 } |
OLD | NEW |