| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 48 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 49 | 49 |
| 50 ASSERT_TRUE(i->size()); | 50 ASSERT_TRUE(i->size()); |
| 51 scoped_refptr<Action> last = i->front(); | 51 scoped_refptr<Action> last = i->front(); |
| 52 | 52 |
| 53 ASSERT_EQ(extension_id, last->extension_id()); | 53 ASSERT_EQ(extension_id, last->extension_id()); |
| 54 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type()); | 54 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type()); |
| 55 ASSERT_EQ("[\"/google_cs.js\"]", | 55 ASSERT_EQ("[\"/google_cs.js\"]", |
| 56 ActivityLogPolicy::Util::Serialize(last->args())); | 56 ActivityLogPolicy::Util::Serialize(last->args())); |
| 57 ASSERT_EQ( | 57 ASSERT_EQ( |
| 58 base::StringPrintf("http://www.google.com.bo:%u/test.html", port), | 58 base::StringPrintf("http://www.google.com.bo:%u/title1.html", port), |
| 59 last->SerializePageUrl()); | 59 last->SerializePageUrl()); |
| 60 ASSERT_EQ( | 60 ASSERT_EQ(base::StringPrintf("www.google.com.bo:%u/title1.html", port), |
| 61 base::StringPrintf("www.google.com.bo:%u/test.html", port), | 61 last->page_title()); |
| 62 last->page_title()); | |
| 63 ASSERT_EQ("{\"prerender\":true}", | 62 ASSERT_EQ("{\"prerender\":true}", |
| 64 ActivityLogPolicy::Util::Serialize(last->other())); | 63 ActivityLogPolicy::Util::Serialize(last->other())); |
| 65 ASSERT_EQ("", last->api_name()); | 64 ASSERT_EQ("", last->api_name()); |
| 66 ASSERT_EQ("", last->SerializeArgUrl()); | 65 ASSERT_EQ("", last->SerializeArgUrl()); |
| 67 } | 66 } |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) { | 69 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) { |
| 71 host_resolver()->AddRule("*", "127.0.0.1"); | 70 host_resolver()->AddRule("*", "127.0.0.1"); |
| 72 ASSERT_TRUE(StartEmbeddedTestServer()); | 71 ASSERT_TRUE(StartEmbeddedTestServer()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 95 base::TimeDelta::FromMinutes(10); | 94 base::TimeDelta::FromMinutes(10); |
| 96 | 95 |
| 97 content::WebContents* web_contents = | 96 content::WebContents* web_contents = |
| 98 browser()->tab_strip_model()->GetActiveWebContents(); | 97 browser()->tab_strip_model()->GetActiveWebContents(); |
| 99 ASSERT_TRUE(web_contents); | 98 ASSERT_TRUE(web_contents); |
| 100 | 99 |
| 101 content::WindowedNotificationObserver page_observer( | 100 content::WindowedNotificationObserver page_observer( |
| 102 content::NOTIFICATION_LOAD_STOP, | 101 content::NOTIFICATION_LOAD_STOP, |
| 103 content::NotificationService::AllSources()); | 102 content::NotificationService::AllSources()); |
| 104 | 103 |
| 105 GURL url(base::StringPrintf( | 104 GURL url(base::StringPrintf("http://www.google.com.bo:%u/title1.html", port)); |
| 106 "http://www.google.com.bo:%u/test.html", | |
| 107 port)); | |
| 108 | 105 |
| 109 const gfx::Size kSize(640, 480); | 106 const gfx::Size kSize(640, 480); |
| 110 std::unique_ptr<prerender::PrerenderHandle> prerender_handle( | 107 std::unique_ptr<prerender::PrerenderHandle> prerender_handle( |
| 111 prerender_manager->AddPrerenderFromOmnibox( | 108 prerender_manager->AddPrerenderFromOmnibox( |
| 112 url, | 109 url, |
| 113 web_contents->GetController().GetDefaultSessionStorageNamespace(), | 110 web_contents->GetController().GetDefaultSessionStorageNamespace(), |
| 114 kSize)); | 111 kSize)); |
| 115 | 112 |
| 116 page_observer.Wait(); | 113 page_observer.Wait(); |
| 117 | 114 |
| 118 activity_log->GetFilteredActions( | 115 activity_log->GetFilteredActions( |
| 119 ext->id(), | 116 ext->id(), |
| 120 Action::ACTION_ANY, | 117 Action::ACTION_ANY, |
| 121 "", | 118 "", |
| 122 "", | 119 "", |
| 123 "", | 120 "", |
| 124 -1, | 121 -1, |
| 125 base::Bind( | 122 base::Bind( |
| 126 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port)); | 123 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port)); |
| 127 | 124 |
| 128 // Allow invocation of Prerender_Arguments | 125 // Allow invocation of Prerender_Arguments |
| 129 base::RunLoop().Run(); | 126 base::RunLoop().Run(); |
| 130 } | 127 } |
| 131 | 128 |
| 132 } // namespace extensions | 129 } // namespace extensions |
| OLD | NEW |