OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "chrome/browser/extensions/activity_log/activity_log.h" | 10 #include "chrome/browser/extensions/activity_log/activity_log.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 Action::ACTION_API_CALL, | 112 Action::ACTION_API_CALL, |
113 "tabs.testMethod"); | 113 "tabs.testMethod"); |
114 activity_log->LogAction(action); | 114 activity_log->LogAction(action); |
115 action = new Action(kExtensionId, | 115 action = new Action(kExtensionId, |
116 base::Time::Now(), | 116 base::Time::Now(), |
117 Action::ACTION_DOM_ACCESS, | 117 Action::ACTION_DOM_ACCESS, |
118 "document.write"); | 118 "document.write"); |
119 action->set_page_url(GURL("http://www.google.com")); | 119 action->set_page_url(GURL("http://www.google.com")); |
120 activity_log->LogAction(action); | 120 activity_log->LogAction(action); |
121 | 121 |
122 activity_log->GetActions( | 122 activity_log->GetFilteredActions( |
123 kExtensionId, | 123 kExtensionId, |
| 124 Action::ACTION_ANY, |
| 125 "", |
| 126 "", |
| 127 "", |
124 0, | 128 0, |
125 base::Bind(ActivityLogTest::RetrieveActions_LogAndFetchActions)); | 129 base::Bind(ActivityLogTest::RetrieveActions_LogAndFetchActions)); |
126 } | 130 } |
127 | 131 |
128 TEST_F(ActivityLogTest, LogPrerender) { | 132 TEST_F(ActivityLogTest, LogPrerender) { |
129 scoped_refptr<const Extension> extension = | 133 scoped_refptr<const Extension> extension = |
130 ExtensionBuilder() | 134 ExtensionBuilder() |
131 .SetManifest(DictionaryBuilder() | 135 .SetManifest(DictionaryBuilder() |
132 .Set("name", "Test extension") | 136 .Set("name", "Test extension") |
133 .Set("version", "1.0.0") | 137 .Set("version", "1.0.0") |
(...skipping 20 matching lines...) Expand all Loading... |
154 ASSERT_EQ(1U, contentses.size()); | 158 ASSERT_EQ(1U, contentses.size()); |
155 content::WebContents *contents = contentses[0]; | 159 content::WebContents *contents = contentses[0]; |
156 ASSERT_TRUE(prerender_manager->IsWebContentsPrerendering(contents, NULL)); | 160 ASSERT_TRUE(prerender_manager->IsWebContentsPrerendering(contents, NULL)); |
157 | 161 |
158 TabHelper::ScriptExecutionObserver::ExecutingScriptsMap executing_scripts; | 162 TabHelper::ScriptExecutionObserver::ExecutingScriptsMap executing_scripts; |
159 executing_scripts[extension->id()].insert("script"); | 163 executing_scripts[extension->id()].insert("script"); |
160 | 164 |
161 static_cast<TabHelper::ScriptExecutionObserver*>(activity_log)-> | 165 static_cast<TabHelper::ScriptExecutionObserver*>(activity_log)-> |
162 OnScriptsExecuted(contents, executing_scripts, 0, url); | 166 OnScriptsExecuted(contents, executing_scripts, 0, url); |
163 | 167 |
164 activity_log->GetActions( | 168 activity_log->GetFilteredActions( |
165 extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Prerender)); | 169 extension->id(), |
| 170 Action::ACTION_ANY, |
| 171 "", |
| 172 "", |
| 173 "", |
| 174 0, |
| 175 base::Bind(ActivityLogTest::Arguments_Prerender)); |
166 | 176 |
167 prerender_manager->CancelAllPrerenders(); | 177 prerender_manager->CancelAllPrerenders(); |
168 } | 178 } |
169 | 179 |
170 } // namespace extensions | 180 } // namespace extensions |
OLD | NEW |