summaryrefslogtreecommitdiffstats
path: root/chrome/test/ui/npapi_test_helper.cc
blob: e3913b07c80e62dffbc409ffaa5ff14e9655bf65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2008, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// Copyright (c) 2009 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 "chrome/test/ui/npapi_test_helper.h"

#include "base/file_util.h"
#include "chrome/common/chrome_switches.h"

NPAPITester::NPAPITester()
    : UITest() {
}

void NPAPITester::SetUp() {
  // We need to copy our test-plugin into the plugins directory so that
  // the browser can load it.
  FilePath plugins_directory = browser_directory_.AppendASCII("plugins");

  FilePath plugin_src = browser_directory_.AppendASCII("npapi_test_plugin.dll");
  plugin_dll_ = plugins_directory.AppendASCII("npapi_test_plugin.dll");

  file_util::CreateDirectory(plugins_directory);
  file_util::CopyFile(plugin_src, plugin_dll_);

  UITest::SetUp();
}

void NPAPITester::TearDown() {
  file_util::Delete(plugin_dll_, false);
  UITest::TearDown();
}


// NPAPIVisiblePluginTester members.
void NPAPIVisiblePluginTester::SetUp() {
  show_window_ = true;
  NPAPITester::SetUp();
}

// NPAPIIncognitoTester members.
void NPAPIIncognitoTester::SetUp() {
  launch_arguments_.AppendSwitch(switches::kIncognito);
  NPAPITester::SetUp();
}