| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 FilePath path(StringPrintf(L"c:\\extension")); | 295 FilePath path(StringPrintf(L"c:\\extension")); |
| 296 #else | 296 #else |
| 297 FilePath path(StringPrintf("/extension")); | 297 FilePath path(StringPrintf("/extension")); |
| 298 #endif | 298 #endif |
| 299 Extension extension(path); | 299 Extension extension(path); |
| 300 std::string error_msg; | 300 std::string error_msg; |
| 301 scoped_ptr<ExtensionAction> action; | 301 scoped_ptr<ExtensionAction> action; |
| 302 DictionaryValue input; | 302 DictionaryValue input; |
| 303 | 303 |
| 304 // First try with an empty dictionary. | 304 // First try with an empty dictionary. |
| 305 ASSERT_TRUE(extension.LoadExtensionActionHelper( | 305 action.reset(extension.LoadExtensionActionHelper(&input, &error_msg)); |
| 306 &input, &error_msg) != NULL); | 306 ASSERT_TRUE(action != NULL); |
| 307 ASSERT_STREQ("", error_msg.c_str()); | 307 ASSERT_STREQ("", error_msg.c_str()); |
| 308 error_msg = ""; | 308 error_msg = ""; |
| 309 | 309 |
| 310 // Now setup some values to use in the action. | 310 // Now setup some values to use in the action. |
| 311 const std::string id("MyExtensionActionId"); | 311 const std::string id("MyExtensionActionId"); |
| 312 const std::string name("MyExtensionActionName"); | 312 const std::string name("MyExtensionActionName"); |
| 313 std::string img1("image1.png"); | 313 std::string img1("image1.png"); |
| 314 std::string img2("image2.png"); | 314 std::string img2("image2.png"); |
| 315 | 315 |
| 316 // Add the dictionary for the contextual action. | 316 // Add the dictionary for the contextual action. |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 scoped_ptr<Extension> new_extension( | 655 scoped_ptr<Extension> new_extension( |
| 656 LoadManifest("allow_silent_upgrade", | 656 LoadManifest("allow_silent_upgrade", |
| 657 std::string(kTests[i].base_name) + "_new.json")); | 657 std::string(kTests[i].base_name) + "_new.json")); |
| 658 | 658 |
| 659 EXPECT_EQ(kTests[i].expect_success, | 659 EXPECT_EQ(kTests[i].expect_success, |
| 660 Extension::IsPrivilegeIncrease(old_extension.get(), | 660 Extension::IsPrivilegeIncrease(old_extension.get(), |
| 661 new_extension.get())) | 661 new_extension.get())) |
| 662 << kTests[i].base_name; | 662 << kTests[i].base_name; |
| 663 } | 663 } |
| 664 } | 664 } |
| OLD | NEW |