OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "chrome/browser/extensions/api/commands/command_service.h" | 6 #include "chrome/browser/extensions/api/commands/command_service.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 #include "components/prefs/scoped_user_pref_update.h" | 10 #include "components/prefs/scoped_user_pref_update.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 namespace extensions { | 39 namespace extensions { |
40 | 40 |
41 typedef ExtensionApiTest CommandServiceTest; | 41 typedef ExtensionApiTest CommandServiceTest; |
42 | 42 |
43 IN_PROC_BROWSER_TEST_F(CommandServiceTest, RemoveShortcutSurvivesUpdate) { | 43 IN_PROC_BROWSER_TEST_F(CommandServiceTest, RemoveShortcutSurvivesUpdate) { |
44 base::ScopedTempDir scoped_temp_dir; | 44 base::ScopedTempDir scoped_temp_dir; |
45 EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); | 45 EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); |
46 base::FilePath pem_path = test_data_dir_. | 46 base::FilePath pem_path = test_data_dir_. |
47 AppendASCII("keybinding").AppendASCII("keybinding.pem"); | 47 AppendASCII("keybinding").AppendASCII("keybinding.pem"); |
48 base::FilePath path_v1 = PackExtensionWithOptions( | 48 base::FilePath path_v1 = |
49 test_data_dir_.AppendASCII("keybinding").AppendASCII("update") | 49 PackExtensionWithOptions(test_data_dir_.AppendASCII("keybinding") |
50 .AppendASCII("v1"), | 50 .AppendASCII("update") |
51 scoped_temp_dir.path().AppendASCII("v1.crx"), | 51 .AppendASCII("v1"), |
52 pem_path, | 52 scoped_temp_dir.GetPath().AppendASCII("v1.crx"), |
53 base::FilePath()); | 53 pem_path, base::FilePath()); |
54 base::FilePath path_v2 = PackExtensionWithOptions( | 54 base::FilePath path_v2 = |
55 test_data_dir_.AppendASCII("keybinding").AppendASCII("update") | 55 PackExtensionWithOptions(test_data_dir_.AppendASCII("keybinding") |
56 .AppendASCII("v2"), | 56 .AppendASCII("update") |
57 scoped_temp_dir.path().AppendASCII("v2.crx"), | 57 .AppendASCII("v2"), |
58 pem_path, | 58 scoped_temp_dir.GetPath().AppendASCII("v2.crx"), |
59 base::FilePath()); | 59 pem_path, base::FilePath()); |
60 | 60 |
61 ExtensionService* service = ExtensionSystem::Get(browser()->profile())-> | 61 ExtensionService* service = ExtensionSystem::Get(browser()->profile())-> |
62 extension_service(); | 62 extension_service(); |
63 CommandService* command_service = CommandService::Get(browser()->profile()); | 63 CommandService* command_service = CommandService::Get(browser()->profile()); |
64 | 64 |
65 const char kId[] = "pgoakhfeplldmjheffidklpoklkppipp"; | 65 const char kId[] = "pgoakhfeplldmjheffidklpoklkppipp"; |
66 | 66 |
67 // Install v1 of the extension. | 67 // Install v1 of the extension. |
68 ASSERT_TRUE(InstallExtension(path_v1, 1)); | 68 ASSERT_TRUE(InstallExtension(path_v1, 1)); |
69 EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); | 69 EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 &command_map)); | 412 &command_map)); |
413 | 413 |
414 ASSERT_EQ(1u, command_map.count(kBasicNamedCommand)); | 414 ASSERT_EQ(1u, command_map.count(kBasicNamedCommand)); |
415 Command command = command_map[kBasicNamedCommand]; | 415 Command command = command_map[kBasicNamedCommand]; |
416 EXPECT_EQ(kBasicNamedKeybinding, | 416 EXPECT_EQ(kBasicNamedKeybinding, |
417 Command::AcceleratorToString(command.accelerator())); | 417 Command::AcceleratorToString(command.accelerator())); |
418 } | 418 } |
419 } | 419 } |
420 | 420 |
421 } // namespace extensions | 421 } // namespace extensions |
OLD | NEW |