| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/extensions/api/messaging/native_messaging_test_util.h" | 9 #include "chrome/browser/extensions/api/messaging/native_messaging_test_util.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/common/chrome_version_info.h" | 12 #include "chrome/common/chrome_version_info.h" |
| 13 #include "chrome/common/extensions/features/feature.h" | 13 #include "extensions/common/features/feature.h" |
| 14 | 14 |
| 15 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NativeMessageBasic) { | 15 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NativeMessageBasic) { |
| 16 base::ScopedTempDir temp_dir; | 16 base::ScopedTempDir temp_dir; |
| 17 base::FilePath manifest_path = temp_dir.path().AppendASCII( | 17 base::FilePath manifest_path = temp_dir.path().AppendASCII( |
| 18 std::string(extensions::kTestNativeMessagingHostName) + ".json"); | 18 std::string(extensions::kTestNativeMessagingHostName) + ".json"); |
| 19 ASSERT_NO_FATAL_FAILURE( | 19 ASSERT_NO_FATAL_FAILURE( |
| 20 extensions::CreateTestNativeHostManifest(manifest_path)); | 20 extensions::CreateTestNativeHostManifest(manifest_path)); |
| 21 | 21 |
| 22 std::string hosts_option = base::StringPrintf( | 22 std::string hosts_option = base::StringPrintf( |
| 23 "%s=%s", extensions::kTestNativeMessagingHostName, | 23 "%s=%s", extensions::kTestNativeMessagingHostName, |
| 24 manifest_path.AsUTF8Unsafe().c_str()); | 24 manifest_path.AsUTF8Unsafe().c_str()); |
| 25 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 25 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 26 switches::kNativeMessagingHosts, hosts_option); | 26 switches::kNativeMessagingHosts, hosts_option); |
| 27 | 27 |
| 28 ASSERT_TRUE(RunExtensionTest("native_messaging")) << message_; | 28 ASSERT_TRUE(RunExtensionTest("native_messaging")) << message_; |
| 29 } | 29 } |
| OLD | NEW |