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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 Extension::GetResourcePath(extension.path(), "../baz.js").value()); | 286 Extension::GetResourcePath(extension.path(), "../baz.js").value()); |
287 } | 287 } |
288 | 288 |
289 TEST(ExtensionTest, LoadPageActionHelper) { | 289 TEST(ExtensionTest, LoadPageActionHelper) { |
290 Extension extension; | 290 Extension extension; |
291 std::string error_msg; | 291 std::string error_msg; |
292 scoped_ptr<PageAction> page_action; | 292 scoped_ptr<PageAction> page_action; |
293 DictionaryValue input; | 293 DictionaryValue input; |
294 | 294 |
295 // First try with an empty dictionary. We should get nothing back. | 295 // First try with an empty dictionary. We should get nothing back. |
296 ASSERT_TRUE(NULL == extension.LoadPageActionHelper(&input, 0, &error_msg)); | 296 ASSERT_EQ(NULL, extension.LoadPageActionHelper(&input, 0, &error_msg)); |
297 ASSERT_STRNE("", error_msg.c_str()); | 297 ASSERT_STRNE("", error_msg.c_str()); |
298 error_msg = ""; | 298 error_msg = ""; |
299 | 299 |
300 // Now setup some values to use in the page action. | 300 // Now setup some values to use in the page action. |
301 const std::string id("MyPageActionId"); | 301 const std::string id("MyPageActionId"); |
302 const std::string name("MyPageActionName"); | 302 const std::string name("MyPageActionName"); |
303 std::string img1("image1.png"); | 303 std::string img1("image1.png"); |
304 std::string img2("image2.png"); | 304 std::string img2("image2.png"); |
305 | 305 |
306 // Add the page_actions dictionary. | 306 // Add the page_actions dictionary. |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 scoped_ptr<Extension> new_extension( | 610 scoped_ptr<Extension> new_extension( |
611 LoadManifest("allow_silent_upgrade", | 611 LoadManifest("allow_silent_upgrade", |
612 std::string(kTests[i].base_name) + "_new.json")); | 612 std::string(kTests[i].base_name) + "_new.json")); |
613 | 613 |
614 EXPECT_EQ(kTests[i].expect_success, | 614 EXPECT_EQ(kTests[i].expect_success, |
615 Extension::IsPrivilegeIncrease(old_extension.get(), | 615 Extension::IsPrivilegeIncrease(old_extension.get(), |
616 new_extension.get())) | 616 new_extension.get())) |
617 << kTests[i].base_name; | 617 << kTests[i].base_name; |
618 } | 618 } |
619 } | 619 } |
OLD | NEW |