OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 #include "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
7 #include "chrome/browser/extensions/extension_test_message_listener.h" | 7 #include "chrome/browser/extensions/extension_test_message_listener.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 ASSERT_TRUE(listener1b.WaitUntilSatisfied()); | 46 ASSERT_TRUE(listener1b.WaitUntilSatisfied()); |
47 | 47 |
48 // Now verify data: urls. | 48 // Now verify data: urls. |
49 url = "data:text/html;charset=utf-8,<html>asdf</html>"; | 49 url = "data:text/html;charset=utf-8,<html>asdf</html>"; |
50 ExtensionTestMessageListener listener2a("content script: " + url, false); | 50 ExtensionTestMessageListener listener2a("content script: " + url, false); |
51 ExtensionTestMessageListener listener2b("execute: " + url, false); | 51 ExtensionTestMessageListener listener2b("execute: " + url, false); |
52 ui_test_utils::NavigateToURL(browser(), GURL(url)); | 52 ui_test_utils::NavigateToURL(browser(), GURL(url)); |
53 ASSERT_TRUE(listener2a.WaitUntilSatisfied()); | 53 ASSERT_TRUE(listener2a.WaitUntilSatisfied()); |
54 ASSERT_TRUE(listener2b.WaitUntilSatisfied()); | 54 ASSERT_TRUE(listener2b.WaitUntilSatisfied()); |
55 | 55 |
56 // Now verify about:version. | 56 // Now verify chrome://version/. |
57 url = "about:version"; | 57 url = "chrome://version/"; |
58 ExtensionTestMessageListener listener3a("content script: " + url, false); | 58 ExtensionTestMessageListener listener3a("content script: " + url, false); |
59 ExtensionTestMessageListener listener3b("execute: " + url, false); | 59 ExtensionTestMessageListener listener3b("execute: " + url, false); |
60 ui_test_utils::NavigateToURL(browser(), GURL(url)); | 60 ui_test_utils::NavigateToURL(browser(), GURL(url)); |
61 ASSERT_TRUE(listener3a.WaitUntilSatisfied()); | 61 ASSERT_TRUE(listener3a.WaitUntilSatisfied()); |
62 ASSERT_TRUE(listener3b.WaitUntilSatisfied()); | 62 ASSERT_TRUE(listener3b.WaitUntilSatisfied()); |
63 | 63 |
64 // Now verify about:blank. | 64 // Now verify about:blank. |
65 url = "about:blank"; | 65 url = "about:blank"; |
66 ExtensionTestMessageListener listener4a("content script: " + url, false); | 66 ExtensionTestMessageListener listener4a("content script: " + url, false); |
67 ExtensionTestMessageListener listener4b("execute: " + url, false); | 67 ExtensionTestMessageListener listener4b("execute: " + url, false); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Now verify we can script a regular http page. | 99 // Now verify we can script a regular http page. |
100 ASSERT_TRUE(test_server()->Start()); | 100 ASSERT_TRUE(test_server()->Start()); |
101 GURL page_url = test_server()->GetURL(kAllUrlsTarget); | 101 GURL page_url = test_server()->GetURL(kAllUrlsTarget); |
102 ExtensionTestMessageListener listener1a("content script: " + page_url.spec(), | 102 ExtensionTestMessageListener listener1a("content script: " + page_url.spec(), |
103 false); | 103 false); |
104 ExtensionTestMessageListener listener1b("execute: " + page_url.spec(), false); | 104 ExtensionTestMessageListener listener1b("execute: " + page_url.spec(), false); |
105 ui_test_utils::NavigateToURL(browser(), page_url); | 105 ui_test_utils::NavigateToURL(browser(), page_url); |
106 ASSERT_TRUE(listener1a.WaitUntilSatisfied()); | 106 ASSERT_TRUE(listener1a.WaitUntilSatisfied()); |
107 ASSERT_TRUE(listener1b.WaitUntilSatisfied()); | 107 ASSERT_TRUE(listener1b.WaitUntilSatisfied()); |
108 } | 108 } |
OLD | NEW |