OLD | NEW |
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 #include "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "chrome/browser/ui/browser_tabstrip.h" | 7 #include "chrome/browser/ui/browser_tabstrip.h" |
8 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
12 #include "content/public/test/browser_test_utils.h" | 12 #include "content/public/test/browser_test_utils.h" |
13 #include "net/base/net_util.h" | 13 #include "net/base/net_util.h" |
14 | 14 |
15 class CalculatorBrowserTest : public InProcessBrowserTest { | 15 class CalculatorBrowserTest : public InProcessBrowserTest { |
16 }; | 16 }; |
17 | 17 |
18 IN_PROC_BROWSER_TEST_F(CalculatorBrowserTest, Model) { | 18 IN_PROC_BROWSER_TEST_F(CalculatorBrowserTest, Model) { |
19 FilePath test_file; | 19 FilePath test_file; |
20 PathService::Get(chrome::DIR_TEST_DATA, &test_file); | 20 PathService::Get(chrome::DIR_TEST_DATA, &test_file); |
21 test_file = test_file.DirName().DirName() | 21 test_file = test_file.DirName().DirName() |
22 .AppendASCII("common").AppendASCII("extensions").AppendASCII("docs") | 22 .AppendASCII("common").AppendASCII("extensions").AppendASCII("docs") |
23 .AppendASCII("examples").AppendASCII("apps").AppendASCII("calculator") | 23 .AppendASCII("examples").AppendASCII("apps").AppendASCII("calculator") |
24 .AppendASCII("tests").AppendASCII("automatic.html"); | 24 .AppendASCII("tests").AppendASCII("automatic.html"); |
25 | 25 |
26 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_file)); | 26 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_file)); |
27 | 27 |
28 bool success; | 28 bool success; |
29 bool executed = content::ExecuteJavaScriptAndExtractBool( | 29 bool executed = content::ExecuteScriptAndExtractBool( |
30 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 30 chrome::GetActiveWebContents(browser()), |
31 "", | |
32 "window.domAutomationController.send(window.runTests().success)", | 31 "window.domAutomationController.send(window.runTests().success)", |
33 &success); | 32 &success); |
34 | 33 |
35 ASSERT_TRUE(executed); | 34 ASSERT_TRUE(executed); |
36 ASSERT_TRUE(success); | 35 ASSERT_TRUE(success); |
37 } | 36 } |
OLD | NEW |