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/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 CommandLine::ForCurrentProcess()->AppendSwitch( | 46 CommandLine::ForCurrentProcess()->AppendSwitch( |
47 switches::kEnableExtensionActivityLogTesting); | 47 switches::kEnableExtensionActivityLogTesting); |
48 ActivityLog::RecomputeLoggingIsEnabled(); | 48 ActivityLog::RecomputeLoggingIsEnabled(); |
49 } | 49 } |
50 | 50 |
51 virtual ~ActivityLogTest() { | 51 virtual ~ActivityLogTest() { |
52 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 52 base::MessageLoop::current()->PostTask(FROM_HERE, |
53 MessageLoop::current()->Run(); | 53 base::MessageLoop::QuitClosure()); |
| 54 base::MessageLoop::current()->Run(); |
54 } | 55 } |
55 | 56 |
56 static void RetrieveActions_LogAndFetchActions( | 57 static void RetrieveActions_LogAndFetchActions( |
57 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { | 58 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { |
58 ASSERT_EQ(2, static_cast<int>(i->size())); | 59 ASSERT_EQ(2, static_cast<int>(i->size())); |
59 } | 60 } |
60 | 61 |
61 static void Arguments_Missing( | 62 static void Arguments_Missing( |
62 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { | 63 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { |
63 scoped_refptr<Action> last = i->front(); | 64 scoped_refptr<Action> last = i->front(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 args->Set(0, new base::StringValue("hello")); | 177 args->Set(0, new base::StringValue("hello")); |
177 args->Set(1, new base::StringValue("world")); | 178 args->Set(1, new base::StringValue("world")); |
178 activity_log->LogAPIAction( | 179 activity_log->LogAPIAction( |
179 extension, std::string("extension.connect"), args.get(), std::string()); | 180 extension, std::string("extension.connect"), args.get(), std::string()); |
180 activity_log->GetActions( | 181 activity_log->GetActions( |
181 extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Present)); | 182 extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Present)); |
182 } | 183 } |
183 | 184 |
184 } // namespace extensions | 185 } // namespace extensions |
185 | 186 |
OLD | NEW |