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