OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 #include "chrome/browser/extensions/activity_log/activity_log.h" | 6 #include "chrome/browser/extensions/activity_log/activity_log.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
9 #include "chrome/browser/prerender/prerender_handle.h" | 9 #include "chrome/browser/prerender/prerender_handle.h" |
10 #include "chrome/browser/prerender/prerender_manager.h" | 10 #include "chrome/browser/prerender/prerender_manager.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 const std::string& extension_id, | 37 const std::string& extension_id, |
38 int port, | 38 int port, |
39 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { | 39 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { |
40 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below | 40 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below |
41 base::MessageLoop::current()->PostTask( | 41 base::MessageLoop::current()->PostTask( |
42 FROM_HERE, base::MessageLoop::QuitClosure()); | 42 FROM_HERE, base::MessageLoop::QuitClosure()); |
43 | 43 |
44 ASSERT_TRUE(i->size()); | 44 ASSERT_TRUE(i->size()); |
45 scoped_refptr<Action> last = i->front(); | 45 scoped_refptr<Action> last = i->front(); |
46 | 46 |
| 47 ASSERT_EQ(extension_id, last->extension_id()); |
47 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type()); | 48 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type()); |
48 ASSERT_EQ("[\"/google_cs.js\"]", | 49 ASSERT_EQ("[\"/google_cs.js\"]", |
49 ActivityLogPolicy::Util::Serialize(last->args())); | 50 ActivityLogPolicy::Util::Serialize(last->args())); |
50 ASSERT_EQ(base::StringPrintf("http://www.google.com.bo:%d/test.html", port), | 51 ASSERT_EQ( |
51 last->page_url().spec()); | 52 base::StringPrintf("http://www.google.com.bo:%d/test.html", port), |
| 53 last->SerializePageUrl()); |
| 54 ASSERT_EQ( |
| 55 base::StringPrintf("www.google.com.bo:%d/test.html", port), |
| 56 last->page_title()); |
52 ASSERT_EQ("{\"prerender\":true}", | 57 ASSERT_EQ("{\"prerender\":true}", |
53 ActivityLogPolicy::Util::Serialize(last->other())); | 58 ActivityLogPolicy::Util::Serialize(last->other())); |
| 59 ASSERT_EQ("", last->api_name()); |
| 60 ASSERT_EQ("", last->SerializeArgUrl()); |
54 } | 61 } |
55 }; | 62 }; |
56 | 63 |
57 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) { | 64 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) { |
58 host_resolver()->AddRule("*", "127.0.0.1"); | 65 host_resolver()->AddRule("*", "127.0.0.1"); |
59 StartEmbeddedTestServer(); | 66 StartEmbeddedTestServer(); |
60 int port = embedded_test_server()->port(); | 67 int port = embedded_test_server()->port(); |
61 | 68 |
62 // Get the extension (chrome/test/data/extensions/activity_log) | 69 // Get the extension (chrome/test/data/extensions/activity_log) |
63 const Extension* ext = | 70 const Extension* ext = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 106 |
100 activity_log->GetActions( | 107 activity_log->GetActions( |
101 ext->id(), 0, base::Bind( | 108 ext->id(), 0, base::Bind( |
102 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port)); | 109 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port)); |
103 | 110 |
104 // Allow invocation of Prerender_Arguments | 111 // Allow invocation of Prerender_Arguments |
105 base::MessageLoop::current()->Run(); | 112 base::MessageLoop::current()->Run(); |
106 } | 113 } |
107 | 114 |
108 } // namespace extensions | 115 } // namespace extensions |
OLD | NEW |