| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/util/extensions_activity_monitor.h" | 5 #include "chrome/browser/sync/util/extensions_activity_monitor.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 template <class FunctionType> | 40 template <class FunctionType> |
| 41 class BookmarkAPIEventTask : public Task { | 41 class BookmarkAPIEventTask : public Task { |
| 42 public: | 42 public: |
| 43 BookmarkAPIEventTask(FunctionType* t, Extension* e, size_t repeats, | 43 BookmarkAPIEventTask(FunctionType* t, Extension* e, size_t repeats, |
| 44 base::WaitableEvent* done) : | 44 base::WaitableEvent* done) : |
| 45 extension_(e), function_(t), repeats_(repeats), done_(done) {} | 45 extension_(e), function_(t), repeats_(repeats), done_(done) {} |
| 46 virtual void Run() { | 46 virtual void Run() { |
| 47 for (size_t i = 0; i < repeats_; i++) { | 47 for (size_t i = 0; i < repeats_; i++) { |
| 48 NotificationService::current()->Notify( | 48 NotificationService::current()->Notify( |
| 49 NotificationType::EXTENSION_BOOKMARKS_API_INVOKED, | 49 chrome::EXTENSION_BOOKMARKS_API_INVOKED, |
| 50 Source<Extension>(extension_.get()), | 50 Source<Extension>(extension_.get()), |
| 51 Details<const BookmarksFunction>(function_.get())); | 51 Details<const BookmarksFunction>(function_.get())); |
| 52 } | 52 } |
| 53 done_->Signal(); | 53 done_->Signal(); |
| 54 } | 54 } |
| 55 private: | 55 private: |
| 56 scoped_refptr<Extension> extension_; | 56 scoped_refptr<Extension> extension_; |
| 57 scoped_refptr<FunctionType> function_; | 57 scoped_refptr<FunctionType> function_; |
| 58 size_t repeats_; | 58 size_t repeats_; |
| 59 base::WaitableEvent* done_; | 59 base::WaitableEvent* done_; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 generator.NewEvent<CreateBookmarkFunction>(kTestExtensionPath1, | 240 generator.NewEvent<CreateBookmarkFunction>(kTestExtensionPath1, |
| 241 new CreateBookmarkFunction(), 3); | 241 new CreateBookmarkFunction(), 3); |
| 242 monitor->GetAndClearRecords(&results); | 242 monitor->GetAndClearRecords(&results); |
| 243 | 243 |
| 244 EXPECT_EQ(1U, results.size()); | 244 EXPECT_EQ(1U, results.size()); |
| 245 EXPECT_EQ(3U, results[id1].bookmark_write_count); | 245 EXPECT_EQ(3U, results[id1].bookmark_write_count); |
| 246 | 246 |
| 247 ui_loop()->DeleteSoon(FROM_HERE, monitor); | 247 ui_loop()->DeleteSoon(FROM_HERE, monitor); |
| 248 } | 248 } |
| OLD | NEW |