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

Side by Side 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: Use environment variable to pass file between test and mock_nacl_gdb 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/command_line.h"
6 #include "base/environment.h"
7 #include "base/file_util.h"
8 #include "base/path_service.h"
9 #include "base/win/windows_version.h"
10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/test/ui/ppapi_uitest.h"
12
13 static const FilePath::CharType kMockNaClGdb[] =
14 #if defined(OS_WIN)
15 FILE_PATH_LITERAL("mock_nacl_gdb.exe");
16 #else
17 FILE_PATH_LITERAL("mock_nacl_gdb");
18 #endif
19
20 class NaClGdbTest : public PPAPINaClTest {
21 public:
22 NaClGdbTest() {
23 }
24
25 void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
26 PPAPINaClTest::SetUpCommandLine(command_line);
27
28 FilePath mock_nacl_gdb;
29 EXPECT_TRUE(PathService::Get(base::DIR_EXE, &mock_nacl_gdb));
30 mock_nacl_gdb = mock_nacl_gdb.Append(kMockNaClGdb);
31 command_line->AppendSwitchPath(switches::kNaClGdb, mock_nacl_gdb);
32 }
33 };
34
35 IN_PROC_BROWSER_TEST_F(NaClGdbTest, Empty) {
36 FilePath mock_nacl_gdb_file;
37 scoped_ptr<base::Environment> env(base::Environment::Create());
38 // TODO(halyavin): Make this test to work on Windows 32-bit. Currently this
39 // is not possible because NaCl doesn't work without sandbox since 1Gb of
40 // space is not reserved. We can't reserve 1Gb of space because
41 // base::LaunchProcess doesn't support creating suspended processes. We need
42 // to either add suspended process support to base::LaunchProcess or use
43 // Win API.
44 if (base::win::OSInfo::GetInstance()->wow64_status() ==
45 base::win::OSInfo::WOW64_DISABLED) {
46 return;
47 }
48 EXPECT_TRUE(file_util::CreateTemporaryFile(&mock_nacl_gdb_file));
49 env->SetVar("MOCK_NACL_GDB", mock_nacl_gdb_file.AsUTF8Unsafe());
Mark Seaborn 2012/03/16 17:28:59 Can you unset the env var afterwards so that it do
halyavin 2012/03/16 17:57:42 Done.
50 RunTestViaHTTP("Empty");
51 EXPECT_TRUE(file_util::PathExists(mock_nacl_gdb_file));
Mark Seaborn 2012/03/16 17:28:59 Surely the file will exist regardless of whether t
halyavin 2012/03/16 17:57:42 Done.
52 EXPECT_TRUE(file_util::Delete(mock_nacl_gdb_file, false));
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698