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(); | |
67 EXPECT_TRUE(has_run_); | 66 EXPECT_TRUE(has_run_); |
68 has_run_ = false; | 67 has_run_ = false; |
69 } | 68 } |
70 | 69 |
71 void Run() { | 70 void Run() { |
72 has_run_ = true; | 71 has_run_ = true; |
73 } | 72 } |
74 | 73 |
75 bool has_run_; | 74 bool has_run_; |
76 }; | 75 }; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 setCookieCallback.SetCookie(cm, gurl, cookie_line); | 420 setCookieCallback.SetCookie(cm, gurl, cookie_line); |
422 | 421 |
423 PerfTimeLogger timer((std::string("GC_") + test_case.name).c_str()); | 422 PerfTimeLogger timer((std::string("GC_") + test_case.name).c_str()); |
424 for (int i = 0; i < kNumCookies; i++) | 423 for (int i = 0; i < kNumCookies; i++) |
425 setCookieCallback.SetCookie(cm, gurl, cookie_line); | 424 setCookieCallback.SetCookie(cm, gurl, cookie_line); |
426 timer.Done(); | 425 timer.Done(); |
427 } | 426 } |
428 } | 427 } |
429 | 428 |
430 } // namespace | 429 } // namespace |
OLD | NEW |