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"
12 #include "base/test/test_reg_util_win.h"
14 #include "base/test/scoped_path_override.h"
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
{
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
);
37 base::ScopedTempDir temp_dir_
;
40 registry_util::RegistryOverrideManager registry_override_
;
42 scoped_ptr
<base::ScopedPathOverride
> path_override_
;
45 DISALLOW_COPY_AND_ASSIGN(ScopedTestNativeMessagingHost
);
48 } // namespace extensions
50 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_TEST_UTIL_H_