| 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 "extensions/browser/guest_view/web_view/web_view_apitest.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_apitest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 DCHECK(app_window_list.size() == 1); | 154 DCHECK(app_window_list.size() == 1); |
| 155 return (*app_window_list.begin())->web_contents(); | 155 return (*app_window_list.begin())->web_contents(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void WebViewAPITest::RunTest(const std::string& test_name, | 158 void WebViewAPITest::RunTest(const std::string& test_name, |
| 159 const std::string& app_location) { | 159 const std::string& app_location) { |
| 160 LaunchApp(app_location); | 160 LaunchApp(app_location); |
| 161 | 161 |
| 162 ExtensionTestMessageListener done_listener("TEST_PASSED", false); | 162 ExtensionTestMessageListener done_listener("TEST_PASSED", false); |
| 163 done_listener.set_failure_message("TEST_FAILED"); | 163 done_listener.set_failure_message("TEST_FAILED"); |
| 164 if (!content::ExecuteScript( | 164 ASSERT_TRUE(content::ExecuteScript( |
| 165 embedder_web_contents_, | 165 embedder_web_contents_, |
| 166 base::StringPrintf("runTest('%s')", test_name.c_str()))) { | 166 base::StringPrintf("runTest('%s')", test_name.c_str()))) |
| 167 LOG(ERROR) << "Unable to start test."; | 167 << "Unable to start test."; |
| 168 return; | |
| 169 } | |
| 170 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | 168 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); |
| 171 } | 169 } |
| 172 | 170 |
| 173 void WebViewAPITest::RunTestOnMainThreadLoop() { | 171 void WebViewAPITest::RunTestOnMainThreadLoop() { |
| 174 AppShellTest::RunTestOnMainThreadLoop(); | 172 AppShellTest::RunTestOnMainThreadLoop(); |
| 175 GetGuestViewManager()->WaitForAllGuestsDeleted(); | 173 GetGuestViewManager()->WaitForAllGuestsDeleted(); |
| 176 } | 174 } |
| 177 | 175 |
| 178 void WebViewAPITest::SetUpCommandLine(base::CommandLine* command_line) { | 176 void WebViewAPITest::SetUpCommandLine(base::CommandLine* command_line) { |
| 179 AppShellTest::SetUpCommandLine(command_line); | 177 AppShellTest::SetUpCommandLine(command_line); |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 // object, on the webview element, and hanging directly off webview. | 699 // object, on the webview element, and hanging directly off webview. |
| 702 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIExistence) { | 700 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIExistence) { |
| 703 RunTest("testWebRequestAPIExistence", "web_view/apitest"); | 701 RunTest("testWebRequestAPIExistence", "web_view/apitest"); |
| 704 } | 702 } |
| 705 | 703 |
| 706 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIGoogleProperty) { | 704 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIGoogleProperty) { |
| 707 RunTest("testWebRequestAPIGoogleProperty", "web_view/apitest"); | 705 RunTest("testWebRequestAPIGoogleProperty", "web_view/apitest"); |
| 708 } | 706 } |
| 709 | 707 |
| 710 } // namespace extensions | 708 } // namespace extensions |
| OLD | NEW |