| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 bool result; | 653 bool result; |
| 654 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 654 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 655 contents, | 655 contents, |
| 656 "window.domAutomationController.send(!!(" + expression + "));", | 656 "window.domAutomationController.send(!!(" + expression + "));", |
| 657 &result)); | 657 &result)); |
| 658 ASSERT_TRUE(result) << expression; | 658 ASSERT_TRUE(result) << expression; |
| 659 } | 659 } |
| 660 | 660 |
| 661 const GURL& GetBackGroundPageUrl(const std::string& extension_id) { | 661 const GURL& GetBackGroundPageUrl(const std::string& extension_id) { |
| 662 extensions::ProcessManager* manager = | 662 extensions::ProcessManager* manager = |
| 663 extensions::ExtensionSystem::Get(profile())->process_manager(); | 663 extensions::ProcessManager::Get(profile()); |
| 664 extensions::ExtensionHost* host = | 664 extensions::ExtensionHost* host = |
| 665 manager->GetBackgroundHostForExtension(extension_id); | 665 manager->GetBackgroundHostForExtension(extension_id); |
| 666 return host->host_contents()->GetURL(); | 666 return host->host_contents()->GetURL(); |
| 667 } | 667 } |
| 668 | 668 |
| 669 void JsExpectOnBackgroundPage(const std::string& extension_id, | 669 void JsExpectOnBackgroundPage(const std::string& extension_id, |
| 670 const std::string& expression) { | 670 const std::string& expression) { |
| 671 extensions::ProcessManager* manager = | 671 extensions::ProcessManager* manager = |
| 672 extensions::ExtensionSystem::Get(profile())->process_manager(); | 672 extensions::ProcessManager::Get(profile()); |
| 673 extensions::ExtensionHost* host = | 673 extensions::ExtensionHost* host = |
| 674 manager->GetBackgroundHostForExtension(extension_id); | 674 manager->GetBackgroundHostForExtension(extension_id); |
| 675 if (host == NULL) { | 675 if (host == NULL) { |
| 676 ADD_FAILURE() << "Extension " << extension_id | 676 ADD_FAILURE() << "Extension " << extension_id |
| 677 << " has no background page."; | 677 << " has no background page."; |
| 678 return; | 678 return; |
| 679 } | 679 } |
| 680 | 680 |
| 681 JsExpect(host->host_contents(), expression); | 681 JsExpect(host->host_contents(), expression); |
| 682 } | 682 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 790 |
| 791 if (!catcher.GetNextResult()) { | 791 if (!catcher.GetNextResult()) { |
| 792 std::string message = catcher.message(); | 792 std::string message = catcher.message(); |
| 793 ADD_FAILURE() << "Tests failed: " << message; | 793 ADD_FAILURE() << "Tests failed: " << message; |
| 794 } | 794 } |
| 795 | 795 |
| 796 EXPECT_TRUE(fake_google_.IsPageRequested()); | 796 EXPECT_TRUE(fake_google_.IsPageRequested()); |
| 797 } | 797 } |
| 798 | 798 |
| 799 } // namespace chromeos | 799 } // namespace chromeos |
| OLD | NEW |