OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 <algorithm> | 5 #include <algorithm> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 EXPECT_EQ(3u, scripts[0].url_patterns().size()); | 535 EXPECT_EQ(3u, scripts[0].url_patterns().size()); |
536 EXPECT_EQ("file://*", | 536 EXPECT_EQ("file://*", |
537 scripts[0].url_patterns()[0].GetAsString()); | 537 scripts[0].url_patterns()[0].GetAsString()); |
538 EXPECT_EQ("http://*.google.com/*", | 538 EXPECT_EQ("http://*.google.com/*", |
539 scripts[0].url_patterns()[1].GetAsString()); | 539 scripts[0].url_patterns()[1].GetAsString()); |
540 EXPECT_EQ("https://*.google.com/*", | 540 EXPECT_EQ("https://*.google.com/*", |
541 scripts[0].url_patterns()[2].GetAsString()); | 541 scripts[0].url_patterns()[2].GetAsString()); |
542 EXPECT_EQ(2u, scripts[0].js_scripts().size()); | 542 EXPECT_EQ(2u, scripts[0].js_scripts().size()); |
543 ExtensionResource resource00(scripts[0].js_scripts()[0].extension_root(), | 543 ExtensionResource resource00(scripts[0].js_scripts()[0].extension_root(), |
544 scripts[0].js_scripts()[0].relative_path()); | 544 scripts[0].js_scripts()[0].relative_path()); |
545 EXPECT_TRUE(resource00.ComparePathWithDefault( | 545 FilePath expected_path(extension->path().AppendASCII("script1.js")); |
546 extension->path().AppendASCII("script1.js"))); | 546 ASSERT_TRUE(file_util::AbsolutePath(&expected_path)); |
| 547 EXPECT_TRUE(resource00.ComparePathWithDefault(expected_path)); |
547 ExtensionResource resource01(scripts[0].js_scripts()[1].extension_root(), | 548 ExtensionResource resource01(scripts[0].js_scripts()[1].extension_root(), |
548 scripts[0].js_scripts()[1].relative_path()); | 549 scripts[0].js_scripts()[1].relative_path()); |
549 EXPECT_TRUE(resource01.ComparePathWithDefault( | 550 expected_path = extension->path().AppendASCII("script2.js"); |
550 extension->path().AppendASCII("script2.js"))); | 551 ASSERT_TRUE(file_util::AbsolutePath(&expected_path)); |
| 552 EXPECT_TRUE(resource01.ComparePathWithDefault(expected_path)); |
551 EXPECT_TRUE(extension->plugins().empty()); | 553 EXPECT_TRUE(extension->plugins().empty()); |
552 EXPECT_EQ(1u, scripts[1].url_patterns().size()); | 554 EXPECT_EQ(1u, scripts[1].url_patterns().size()); |
553 EXPECT_EQ("http://*.news.com/*", scripts[1].url_patterns()[0].GetAsString()); | 555 EXPECT_EQ("http://*.news.com/*", scripts[1].url_patterns()[0].GetAsString()); |
554 ExtensionResource resource10(scripts[1].js_scripts()[0].extension_root(), | 556 ExtensionResource resource10(scripts[1].js_scripts()[0].extension_root(), |
555 scripts[1].js_scripts()[0].relative_path()); | 557 scripts[1].js_scripts()[0].relative_path()); |
556 EXPECT_TRUE(resource10.ComparePathWithDefault( | 558 expected_path = |
557 extension->path().AppendASCII("js_files").AppendASCII("script3.js"))); | 559 extension->path().AppendASCII("js_files").AppendASCII("script3.js"); |
| 560 ASSERT_TRUE(file_util::AbsolutePath(&expected_path)); |
| 561 EXPECT_TRUE(resource10.ComparePathWithDefault(expected_path)); |
558 const std::vector<URLPattern> permissions = extension->host_permissions(); | 562 const std::vector<URLPattern> permissions = extension->host_permissions(); |
559 ASSERT_EQ(2u, permissions.size()); | 563 ASSERT_EQ(2u, permissions.size()); |
560 EXPECT_EQ("http://*.google.com/*", permissions[0].GetAsString()); | 564 EXPECT_EQ("http://*.google.com/*", permissions[0].GetAsString()); |
561 EXPECT_EQ("https://*.google.com/*", permissions[1].GetAsString()); | 565 EXPECT_EQ("https://*.google.com/*", permissions[1].GetAsString()); |
562 ASSERT_EQ(2u, toolstrips.size()); | 566 ASSERT_EQ(2u, toolstrips.size()); |
563 EXPECT_EQ(extension->GetResourceURL("toolstrip1.html"), | 567 EXPECT_EQ(extension->GetResourceURL("toolstrip1.html"), |
564 toolstrips[0].toolstrip); | 568 toolstrips[0].toolstrip); |
565 EXPECT_EQ(extension->GetResourceURL("lorem_ipsum.html"), | 569 EXPECT_EQ(extension->GetResourceURL("lorem_ipsum.html"), |
566 toolstrips[0].mole); | 570 toolstrips[0].mole); |
567 EXPECT_EQ(200, toolstrips[0].mole_height); | 571 EXPECT_EQ(200, toolstrips[0].mole_height); |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 | 1566 |
1563 recorder.set_ready(false); | 1567 recorder.set_ready(false); |
1564 command_line.reset(new CommandLine(CommandLine::ARGUMENTS_ONLY)); | 1568 command_line.reset(new CommandLine(CommandLine::ARGUMENTS_ONLY)); |
1565 service = new ExtensionsService(&profile, command_line.get(), | 1569 service = new ExtensionsService(&profile, command_line.get(), |
1566 profile.GetPrefs(), install_dir, &loop, &loop, false); | 1570 profile.GetPrefs(), install_dir, &loop, &loop, false); |
1567 EXPECT_FALSE(service->extensions_enabled()); | 1571 EXPECT_FALSE(service->extensions_enabled()); |
1568 service->Init(); | 1572 service->Init(); |
1569 loop.RunAllPending(); | 1573 loop.RunAllPending(); |
1570 EXPECT_TRUE(recorder.ready()); | 1574 EXPECT_TRUE(recorder.ready()); |
1571 } | 1575 } |
OLD | NEW |