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/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
8 #include "chrome/browser/extensions/activity_log/activity_log.h" | 8 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 9 #include "chrome/browser/extensions/activity_log/dom_actions.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/test_extension_system.h" | 11 #include "chrome/browser/extensions/test_extension_system.h" |
11 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/extensions/extension_builder.h" | 14 #include "chrome/common/extensions/extension_builder.h" |
14 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 15 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/test/test_browser_thread.h" | 18 #include "content/public/test/test_browser_thread.h" |
18 #include "sql/statement.h" | 19 #include "sql/statement.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 ASSERT_TRUE(ActivityLog::IsLogEnabled()); | 125 ASSERT_TRUE(ActivityLog::IsLogEnabled()); |
125 | 126 |
126 // Write some API calls | 127 // Write some API calls |
127 activity_log->LogAPIAction( | 128 activity_log->LogAPIAction( |
128 extension, std::string("tabs.testMethod"), args.get(), std::string()); | 129 extension, std::string("tabs.testMethod"), args.get(), std::string()); |
129 activity_log->LogDOMAction(extension, | 130 activity_log->LogDOMAction(extension, |
130 GURL("http://www.google.com"), | 131 GURL("http://www.google.com"), |
131 string16(), | 132 string16(), |
132 std::string("document.write"), | 133 std::string("document.write"), |
133 args.get(), | 134 args.get(), |
| 135 DOMAction::METHOD, |
134 std::string("extra")); | 136 std::string("extra")); |
135 activity_log->GetActions( | 137 activity_log->GetActions( |
136 extension->id(), | 138 extension->id(), |
137 0, | 139 0, |
138 base::Bind(ActivityLogTest::RetrieveActions_LogAndFetchActions)); | 140 base::Bind(ActivityLogTest::RetrieveActions_LogAndFetchActions)); |
139 } | 141 } |
140 | 142 |
141 TEST_F(ActivityLogTest, LogWithoutArguments) { | 143 TEST_F(ActivityLogTest, LogWithoutArguments) { |
142 ActivityLog* activity_log = ActivityLog::GetInstance(profile_); | 144 ActivityLog* activity_log = ActivityLog::GetInstance(profile_); |
143 activity_log->SetArgumentLoggingForTesting(false); | 145 activity_log->SetArgumentLoggingForTesting(false); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 args->Set(0, new base::StringValue("hello")); | 178 args->Set(0, new base::StringValue("hello")); |
177 args->Set(1, new base::StringValue("world")); | 179 args->Set(1, new base::StringValue("world")); |
178 activity_log->LogAPIAction( | 180 activity_log->LogAPIAction( |
179 extension, std::string("extension.connect"), args.get(), std::string()); | 181 extension, std::string("extension.connect"), args.get(), std::string()); |
180 activity_log->GetActions( | 182 activity_log->GetActions( |
181 extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Present)); | 183 extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Present)); |
182 } | 184 } |
183 | 185 |
184 } // namespace extensions | 186 } // namespace extensions |
185 | 187 |
OLD | NEW |