Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/test/ppapi/ppapi_browsertest.cc

Issue 723623002: Add Non-SFI test for a NaCl packaged app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 virtual void SetUpOnMainThread() override {
dmichael (off chromium) 2014/11/12 18:49:13 nit: Newly preferred style is only to use override
teravest 2014/11/12 20:02:05 I just removed this method.
1342 } 1343 }
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() {
1377 toolchain_ = "newlib";
1378 }
1379 };
1380
1381 class NonSfiPackagedAppTest : public PackagedAppTest {
1382 public:
1383 NonSfiPackagedAppTest() {
1384 toolchain_ = "nonsfi";
dmichael (off chromium) 2014/11/12 18:49:13 nit: Better to do it in the initializer list (here
teravest 2014/11/12 20:02:05 Done.
1385 }
1386 virtual void SetUpCommandLine(base::CommandLine* command_line) {
dmichael (off chromium) 2014/11/12 18:49:13 nit: override instead of virtual?
teravest 2014/11/12 20:02:05 Done.
1387 PackagedAppTest::SetUpCommandLine(command_line);
1388 command_line->AppendSwitch(switches::kEnableNaClNonSfiMode);
1389 }
1363 }; 1390 };
1364 1391
1365 // Load a packaged app, and wait for it to successfully post a "hello" message 1392 // Load a packaged app, and wait for it to successfully post a "hello" message
1366 // back. 1393 // back.
1367 IN_PROC_BROWSER_TEST_F(PackagedAppTest, SuccessfulLoad) { 1394 IN_PROC_BROWSER_TEST_F(NewlibPackagedAppTest, SuccessfulLoad) {
1368 ExtensionTestMessageListener listener("hello", true); 1395 RunTests();
1369 LaunchTestingApp();
1370 EXPECT_TRUE(listener.WaitUntilSatisfied());
1371 } 1396 }
1397
1398 IN_PROC_BROWSER_TEST_F(NonSfiPackagedAppTest,
1399 MAYBE_PNACL_NONSFI(SuccessfulLoad)) {
1400 RunTests();
1401 }
OLDNEW
« no previous file with comments | « no previous file | ppapi/tests/extensions/extensions.gyp » ('j') | ppapi/tests/extensions/extensions.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698