| 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/path_service.h" | 5 #include "base/path_service.h" |
| 6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_navigator.h" | 11 #include "chrome/browser/ui/browser_navigator.h" |
| 12 #include "chrome/browser/ui/extensions/app_launch_params.h" | 12 #include "chrome/browser/ui/extensions/app_launch_params.h" |
| 13 #include "chrome/browser/ui/extensions/application_launch.h" | 13 #include "chrome/browser/ui/extensions/application_launch.h" |
| 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
| 17 #include "chrome/test/nacl/nacl_browsertest_util.h" | 17 #include "chrome/test/nacl/nacl_browsertest_util.h" |
| 18 #include "chrome/test/ppapi/ppapi_test.h" | 18 #include "chrome/test/ppapi/ppapi_test.h" |
| 19 #include "components/content_settings/core/browser/host_content_settings_map.h" | 19 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 20 #include "components/nacl/common/nacl_switches.h" |
| 20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/common/url_constants.h" | 22 #include "content/public/common/url_constants.h" |
| 22 #include "content/public/test/javascript_test_observer.h" | 23 #include "content/public/test/javascript_test_observer.h" |
| 23 #include "content/public/test/test_renderer_host.h" | 24 #include "content/public/test/test_renderer_host.h" |
| 24 #include "extensions/test/extension_test_message_listener.h" | 25 #include "extensions/test/extension_test_message_listener.h" |
| 25 #include "ppapi/shared_impl/test_harness_utils.h" | 26 #include "ppapi/shared_impl/test_harness_utils.h" |
| 26 | 27 |
| 27 using content::RenderViewHost; | 28 using content::RenderViewHost; |
| 28 | 29 |
| 29 // This macro finesses macro expansion to do what we want. | 30 // This macro finesses macro expansion to do what we want. |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 | 1332 |
| 1332 TEST_PPAPI_IN_PROCESS(TalkPrivate) | 1333 TEST_PPAPI_IN_PROCESS(TalkPrivate) |
| 1333 TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate) | 1334 TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate) |
| 1334 | 1335 |
| 1335 #if defined(OS_CHROMEOS) | 1336 #if defined(OS_CHROMEOS) |
| 1336 TEST_PPAPI_OUT_OF_PROCESS(OutputProtectionPrivate) | 1337 TEST_PPAPI_OUT_OF_PROCESS(OutputProtectionPrivate) |
| 1337 #endif | 1338 #endif |
| 1338 | 1339 |
| 1339 class PackagedAppTest : public ExtensionBrowserTest { | 1340 class PackagedAppTest : public ExtensionBrowserTest { |
| 1340 public: | 1341 public: |
| 1341 virtual void SetUpOnMainThread() override { | 1342 explicit PackagedAppTest(const std::string& toolchain) |
| 1342 } | 1343 : toolchain_(toolchain) { } |
| 1343 | 1344 |
| 1344 void LaunchTestingApp() { | 1345 void LaunchTestingApp() { |
| 1345 base::FilePath data_dir; | 1346 base::FilePath data_dir; |
| 1346 ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &data_dir)); | 1347 ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &data_dir)); |
| 1347 base::FilePath app_dir = data_dir.AppendASCII("ppapi") | 1348 base::FilePath app_dir = data_dir.AppendASCII("ppapi") |
| 1348 .AppendASCII("tests") | 1349 .AppendASCII("tests") |
| 1349 .AppendASCII("extensions") | 1350 .AppendASCII("extensions") |
| 1350 .AppendASCII("packaged_app") | 1351 .AppendASCII("packaged_app") |
| 1351 .AppendASCII("newlib"); | 1352 .AppendASCII(toolchain_); |
| 1352 | 1353 |
| 1353 const extensions::Extension* extension = LoadExtension(app_dir); | 1354 const extensions::Extension* extension = LoadExtension(app_dir); |
| 1354 ASSERT_TRUE(extension); | 1355 ASSERT_TRUE(extension); |
| 1355 | 1356 |
| 1356 AppLaunchParams params(browser()->profile(), | 1357 AppLaunchParams params(browser()->profile(), |
| 1357 extension, | 1358 extension, |
| 1358 extensions::LAUNCH_CONTAINER_NONE, | 1359 extensions::LAUNCH_CONTAINER_NONE, |
| 1359 NEW_WINDOW); | 1360 NEW_WINDOW); |
| 1360 params.command_line = *CommandLine::ForCurrentProcess(); | 1361 params.command_line = *CommandLine::ForCurrentProcess(); |
| 1361 OpenApplication(params); | 1362 OpenApplication(params); |
| 1362 } | 1363 } |
| 1364 |
| 1365 void RunTests() { |
| 1366 ExtensionTestMessageListener listener("hello", true); |
| 1367 LaunchTestingApp(); |
| 1368 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 1369 } |
| 1370 protected: |
| 1371 std::string toolchain_; |
| 1372 }; |
| 1373 |
| 1374 class NewlibPackagedAppTest : public PackagedAppTest { |
| 1375 public: |
| 1376 NewlibPackagedAppTest() : PackagedAppTest("newlib") { } |
| 1377 }; |
| 1378 |
| 1379 class NonSfiPackagedAppTest : public PackagedAppTest { |
| 1380 public: |
| 1381 NonSfiPackagedAppTest() : PackagedAppTest("nonsfi") { } |
| 1382 |
| 1383 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 1384 PackagedAppTest::SetUpCommandLine(command_line); |
| 1385 command_line->AppendSwitch(switches::kEnableNaClNonSfiMode); |
| 1386 } |
| 1363 }; | 1387 }; |
| 1364 | 1388 |
| 1365 // Load a packaged app, and wait for it to successfully post a "hello" message | 1389 // Load a packaged app, and wait for it to successfully post a "hello" message |
| 1366 // back. | 1390 // back. |
| 1367 IN_PROC_BROWSER_TEST_F(PackagedAppTest, SuccessfulLoad) { | 1391 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest, SuccessfulLoad) { |
| 1368 ExtensionTestMessageListener listener("hello", true); | 1392 RunTests(); |
| 1369 LaunchTestingApp(); | |
| 1370 EXPECT_TRUE(listener.WaitUntilSatisfied()); | |
| 1371 } | 1393 } |
| 1394 |
| 1395 IN_PROC_BROWSER_TEST_F(NonSfiPackagedAppTest, |
| 1396 MAYBE_PNACL_NONSFI(SuccessfulLoad)) { |
| 1397 RunTests(); |
| 1398 } |
| OLD | NEW |