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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 Extension::GetResourcePath(extension.path(), "../baz.js").value()); | 276 Extension::GetResourcePath(extension.path(), "../baz.js").value()); |
277 } | 277 } |
278 | 278 |
279 TEST(ExtensionTest, LoadPageActionHelper) { | 279 TEST(ExtensionTest, LoadPageActionHelper) { |
280 Extension extension; | 280 Extension extension; |
281 std::string error_msg; | 281 std::string error_msg; |
282 scoped_ptr<ContextualAction> action; | 282 scoped_ptr<ContextualAction> action; |
283 DictionaryValue input; | 283 DictionaryValue input; |
284 | 284 |
285 // First try with an empty dictionary. We should get nothing back. | 285 // First try with an empty dictionary. We should get nothing back. |
286 ASSERT_EQ(NULL, extension.LoadContextualActionHelper( | 286 ASSERT_TRUE(extension.LoadContextualActionHelper( |
287 &input, 0, &error_msg, ContextualAction::PAGE_ACTION)); | 287 &input, 0, &error_msg, ContextualAction::PAGE_ACTION) == NULL); |
288 ASSERT_STRNE("", error_msg.c_str()); | 288 ASSERT_STRNE("", error_msg.c_str()); |
289 error_msg = ""; | 289 error_msg = ""; |
290 | 290 |
291 // Now try the same, but as a browser action. Ensure same results. | 291 // Now try the same, but as a browser action. Ensure same results. |
292 ASSERT_EQ(NULL, extension.LoadContextualActionHelper( | 292 ASSERT_TRUE(extension.LoadContextualActionHelper( |
293 &input, 0, &error_msg, ContextualAction::BROWSER_ACTION)); | 293 &input, 0, &error_msg, ContextualAction::BROWSER_ACTION) == NULL); |
294 ASSERT_STRNE("", error_msg.c_str()); | 294 ASSERT_STRNE("", error_msg.c_str()); |
295 error_msg = ""; | 295 error_msg = ""; |
296 | 296 |
297 // Now setup some values to use in the page action. | 297 // Now setup some values to use in the page action. |
298 const std::string id("MyContextualActionId"); | 298 const std::string id("MyContextualActionId"); |
299 const std::string name("MyContextualActionName"); | 299 const std::string name("MyContextualActionName"); |
300 std::string img1("image1.png"); | 300 std::string img1("image1.png"); |
301 std::string img2("image2.png"); | 301 std::string img2("image2.png"); |
302 | 302 |
303 // Add the dictionary for the contextual action. | 303 // Add the dictionary for the contextual action. |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 scoped_ptr<Extension> new_extension( | 649 scoped_ptr<Extension> new_extension( |
650 LoadManifest("allow_silent_upgrade", | 650 LoadManifest("allow_silent_upgrade", |
651 std::string(kTests[i].base_name) + "_new.json")); | 651 std::string(kTests[i].base_name) + "_new.json")); |
652 | 652 |
653 EXPECT_EQ(kTests[i].expect_success, | 653 EXPECT_EQ(kTests[i].expect_success, |
654 Extension::IsPrivilegeIncrease(old_extension.get(), | 654 Extension::IsPrivilegeIncrease(old_extension.get(), |
655 new_extension.get())) | 655 new_extension.get())) |
656 << kTests[i].base_name; | 656 << kTests[i].base_name; |
657 } | 657 } |
658 } | 658 } |
OLD | NEW |