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.h" | 8 #include "chrome/browser/extensions/activity_log.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/test_extension_system.h" | 10 #include "chrome/browser/extensions/test_extension_system.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/chromeos/login/user_manager.h" | 22 #include "chrome/browser/chromeos/login/user_manager.h" |
23 #include "chrome/browser/chromeos/settings/cros_settings.h" | 23 #include "chrome/browser/chromeos/settings/cros_settings.h" |
24 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 24 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
25 #endif | 25 #endif |
26 | 26 |
27 namespace extensions { | 27 namespace extensions { |
28 | 28 |
29 class ActivityLogTest : public ChromeRenderViewHostTestHarness { | 29 class ActivityLogTest : public ChromeRenderViewHostTestHarness { |
30 public: | 30 public: |
31 ActivityLogTest() | 31 ActivityLogTest() |
32 : ui_thread_(BrowserThread::UI, MessageLoop::current()), | 32 : ui_thread_(BrowserThread::UI, base::MessageLoop::current()), |
33 db_thread_(BrowserThread::DB, MessageLoop::current()), | 33 db_thread_(BrowserThread::DB, base::MessageLoop::current()), |
34 file_thread_(BrowserThread::FILE, MessageLoop::current()) {} | 34 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) {} |
35 | 35 |
36 virtual void SetUp() OVERRIDE { | 36 virtual void SetUp() OVERRIDE { |
37 ChromeRenderViewHostTestHarness::SetUp(); | 37 ChromeRenderViewHostTestHarness::SetUp(); |
38 CommandLine command_line(CommandLine::NO_PROGRAM); | 38 CommandLine command_line(CommandLine::NO_PROGRAM); |
39 profile_ = | 39 profile_ = |
40 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 40 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
41 extension_service_ = static_cast<TestExtensionSystem*>( | 41 extension_service_ = static_cast<TestExtensionSystem*>( |
42 ExtensionSystem::Get(profile_))->CreateExtensionService( | 42 ExtensionSystem::Get(profile_))->CreateExtensionService( |
43 &command_line, base::FilePath(), false); | 43 &command_line, base::FilePath(), false); |
44 CommandLine::ForCurrentProcess()->AppendSwitch( | 44 CommandLine::ForCurrentProcess()->AppendSwitch( |
45 switches::kEnableExtensionActivityUI); | 45 switches::kEnableExtensionActivityUI); |
46 ActivityLog::RecomputeLoggingIsEnabled(); | 46 ActivityLog::RecomputeLoggingIsEnabled(); |
47 } | 47 } |
48 | 48 |
49 virtual ~ActivityLogTest() { | 49 virtual ~ActivityLogTest() { |
50 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 50 base::MessageLoop::current()->PostTask(FROM_HERE, |
51 MessageLoop::current()->Run(); | 51 base::MessageLoop::QuitClosure()); |
| 52 base::MessageLoop::current()->Run(); |
52 } | 53 } |
53 | 54 |
54 static void RetrieveActions_LogAndFetchActions( | 55 static void RetrieveActions_LogAndFetchActions( |
55 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { | 56 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { |
56 ASSERT_EQ(2, static_cast<int>(i->size())); | 57 ASSERT_EQ(2, static_cast<int>(i->size())); |
57 } | 58 } |
58 | 59 |
59 static void Arguments_Missing( | 60 static void Arguments_Missing( |
60 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { | 61 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { |
61 scoped_refptr<Action> last = i->front(); | 62 scoped_refptr<Action> last = i->front(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 args->Set(0, new base::StringValue("hello")); | 175 args->Set(0, new base::StringValue("hello")); |
175 args->Set(1, new base::StringValue("world")); | 176 args->Set(1, new base::StringValue("world")); |
176 activity_log->LogAPIAction( | 177 activity_log->LogAPIAction( |
177 extension, std::string("extension.connect"), args.get(), std::string()); | 178 extension, std::string("extension.connect"), args.get(), std::string()); |
178 activity_log->GetActions( | 179 activity_log->GetActions( |
179 extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Present)); | 180 extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Present)); |
180 } | 181 } |
181 | 182 |
182 } // namespace extensions | 183 } // namespace extensions |
183 | 184 |
OLD | NEW |