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

Unified Diff: chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc

Issue 9662055: Test for --nacl-gdb functionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/nacl_host/test/mock_nacl_gdb.gyp ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc
===================================================================
--- chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc (revision 0)
+++ chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc (working copy)
@@ -0,0 +1,56 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/command_line.h"
+#include "base/environment.h"
+#include "base/file_util.h"
+#include "base/path_service.h"
+#include "base/win/windows_version.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/test/ui/ppapi_uitest.h"
+
+static const FilePath::CharType kMockNaClGdb[] =
+#if defined(OS_WIN)
+ FILE_PATH_LITERAL("mock_nacl_gdb.exe");
+#else
+ FILE_PATH_LITERAL("mock_nacl_gdb");
+#endif
+
+class NaClGdbTest : public PPAPINaClTest {
+ public:
+ NaClGdbTest() {
+ }
+
+ void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+ PPAPINaClTest::SetUpCommandLine(command_line);
+
+ FilePath mock_nacl_gdb;
+ EXPECT_TRUE(PathService::Get(base::DIR_EXE, &mock_nacl_gdb));
+ mock_nacl_gdb = mock_nacl_gdb.Append(kMockNaClGdb);
+ command_line->AppendSwitchPath(switches::kNaClGdb, mock_nacl_gdb);
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(NaClGdbTest, Empty) {
+ FilePath mock_nacl_gdb_file;
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::string content;
+ // TODO(halyavin): Make this test to work on Windows 32-bit. Currently this
+ // is not possible because NaCl doesn't work without sandbox since 1Gb of
+ // space is not reserved. We can't reserve 1Gb of space because
+ // base::LaunchProcess doesn't support creating suspended processes. We need
+ // to either add suspended process support to base::LaunchProcess or use
+ // Win API.
+ if (base::win::OSInfo::GetInstance()->wow64_status() ==
+ base::win::OSInfo::WOW64_DISABLED) {
+ return;
+ }
+ EXPECT_TRUE(file_util::CreateTemporaryFile(&mock_nacl_gdb_file));
+ env->SetVar("MOCK_NACL_GDB", mock_nacl_gdb_file.AsUTF8Unsafe());
+ RunTestViaHTTP("Empty");
+ env->UnSetVar("MOCK_NACL_GDB");
+ EXPECT_TRUE(file_util::ReadFileToString(mock_nacl_gdb_file, &content));
+ EXPECT_STREQ("PASS", content.c_str());
+ EXPECT_TRUE(file_util::Delete(mock_nacl_gdb_file, false));
+}
« no previous file with comments | « chrome/browser/nacl_host/test/mock_nacl_gdb.gyp ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698