| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "chrome/browser/browser.h" | 6 #include "chrome/browser/browser.h" |
| 7 #include "chrome/browser/renderer_host/render_view_host.h" | 7 #include "chrome/browser/renderer_host/render_view_host.h" |
| 8 #include "chrome/browser/profile.h" | 8 #include "chrome/browser/profile.h" |
| 9 #include "chrome/browser/extensions/extension_error_reporter.h" | 9 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 10 #include "chrome/browser/extensions/extension_view.h" | 10 #include "chrome/browser/extensions/extension_view.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 36 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 37 new MessageLoop::QuitTask, kAlertTimeoutMs); | 37 new MessageLoop::QuitTask, kAlertTimeoutMs); |
| 38 ui_test_utils::RunMessageLoop(); | 38 ui_test_utils::RunMessageLoop(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool got_message() { return got_message_; } | 41 bool got_message() { return got_message_; } |
| 42 private: | 42 private: |
| 43 virtual void RunJavaScriptMessage( | 43 virtual void RunJavaScriptMessage( |
| 44 const std::wstring& message, | 44 const std::wstring& message, |
| 45 const std::wstring& default_prompt, | 45 const std::wstring& default_prompt, |
| 46 const GURL& frame_url, |
| 46 const int flags, | 47 const int flags, |
| 47 IPC::Message* reply_msg, | 48 IPC::Message* reply_msg, |
| 48 bool* did_suppress_message) { | 49 bool* did_suppress_message) { |
| 49 got_message_ = true; | 50 got_message_ = true; |
| 50 MessageLoopForUI::current()->Quit(); | 51 MessageLoopForUI::current()->Quit(); |
| 51 } | 52 } |
| 52 | 53 |
| 53 bool got_message_; | 54 bool got_message_; |
| 54 }; | 55 }; |
| 55 | 56 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 124 |
| 124 // Now wait for it to load, and grab a pointer to it. | 125 // Now wait for it to load, and grab a pointer to it. |
| 125 Extension* extension = observer.WaitForExtension(); | 126 Extension* extension = observer.WaitForExtension(); |
| 126 ASSERT_TRUE(extension); | 127 ASSERT_TRUE(extension); |
| 127 GURL url = Extension::GetResourceURL(extension->url(), "index.html"); | 128 GURL url = Extension::GetResourceURL(extension->url(), "index.html"); |
| 128 | 129 |
| 129 // Start the extension process and wait for it to show a javascript alert. | 130 // Start the extension process and wait for it to show a javascript alert. |
| 130 MockExtensionView view(url, profile); | 131 MockExtensionView view(url, profile); |
| 131 EXPECT_TRUE(view.got_message()); | 132 EXPECT_TRUE(view.got_message()); |
| 132 } | 133 } |
| OLD | NEW |