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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/perftimer.h" | 9 #include "base/perftimer.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 public: | 56 public: |
57 BaseCallback() : has_run_(false) {} | 57 BaseCallback() : has_run_(false) {} |
58 | 58 |
59 protected: | 59 protected: |
60 void WaitForCallback() { | 60 void WaitForCallback() { |
61 // Note that the performance tests currently all operate on a loaded cookie | 61 // Note that the performance tests currently all operate on a loaded cookie |
62 // store (or, more precisely, one that has no backing persistent store). | 62 // store (or, more precisely, one that has no backing persistent store). |
63 // Therefore, callbacks will actually always complete synchronously. If the | 63 // Therefore, callbacks will actually always complete synchronously. If the |
64 // tests get more advanced we need to add other means of signaling | 64 // tests get more advanced we need to add other means of signaling |
65 // completion. | 65 // completion. |
| 66 MessageLoop::current()->RunAllPending(); |
66 EXPECT_TRUE(has_run_); | 67 EXPECT_TRUE(has_run_); |
67 has_run_ = false; | 68 has_run_ = false; |
68 } | 69 } |
69 | 70 |
70 void Run() { | 71 void Run() { |
71 has_run_ = true; | 72 has_run_ = true; |
72 } | 73 } |
73 | 74 |
74 bool has_run_; | 75 bool has_run_; |
75 }; | 76 }; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 setCookieCallback.SetCookie(cm, gurl, cookie_line); | 421 setCookieCallback.SetCookie(cm, gurl, cookie_line); |
421 | 422 |
422 PerfTimeLogger timer((std::string("GC_") + test_case.name).c_str()); | 423 PerfTimeLogger timer((std::string("GC_") + test_case.name).c_str()); |
423 for (int i = 0; i < kNumCookies; i++) | 424 for (int i = 0; i < kNumCookies; i++) |
424 setCookieCallback.SetCookie(cm, gurl, cookie_line); | 425 setCookieCallback.SetCookie(cm, gurl, cookie_line); |
425 timer.Done(); | 426 timer.Done(); |
426 } | 427 } |
427 } | 428 } |
428 | 429 |
429 } // namespace | 430 } // namespace |
OLD | NEW |