Revert 285173 "Removed InProcessBrowserTest::CleanUpOnMainThread()"
[chromium-blink-merge.git] / chrome / browser / extensions / api / messaging / native_messaging_test_util.h
blobf1eba276b9c975b7f422a0f70fc1a7739aed4e2e
1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_TEST_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_TEST_UTIL_H_
8 #include "base/files/scoped_temp_dir.h"
9 #include "base/memory/scoped_ptr.h"
11 #if defined(OS_WIN)
12 #include "base/test/test_reg_util_win.h"
13 #else
14 #include "base/test/scoped_path_override.h"
15 #endif
17 namespace extensions {
19 // Helper class for native messaging tests. When RegisterTestHost() is called it
20 // creates the following manifest files:
21 // kHostName ("com.google.chrome.test.echo") - Echo NM host that runs, see
22 // chrome/test/data/native_messaging/native_hosts/echo.py .
23 // kBinaryMissingHostName ("com.google.chrome.test.host_binary_missing") -
24 // Manifest file that points to a nonexistent host binary.
25 class ScopedTestNativeMessagingHost {
26 public:
27 static const char kHostName[];
28 static const char kBinaryMissingHostName[];
29 static const char kExtensionId[];
31 ScopedTestNativeMessagingHost();
32 ~ScopedTestNativeMessagingHost();
34 void RegisterTestHost(bool user_level);
36 private:
37 base::ScopedTempDir temp_dir_;
39 #if defined(OS_WIN)
40 registry_util::RegistryOverrideManager registry_override_;
41 #else
42 scoped_ptr<base::ScopedPathOverride> path_override_;
43 #endif
45 DISALLOW_COPY_AND_ASSIGN(ScopedTestNativeMessagingHost);
48 } // namespace extensions
50 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_TEST_UTIL_H_