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 "chrome/browser/google_apis/operation_registry.h" | 5 #include "chrome/browser/google_apis/operation_registry.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/google_apis/operation_registry.h" | 10 #include "chrome/browser/google_apis/operation_registry.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 using OperationRegistry::Operation::NotifyResume; | 34 using OperationRegistry::Operation::NotifyResume; |
35 }; | 35 }; |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 class OperationRegistryTest : public testing::Test { | 39 class OperationRegistryTest : public testing::Test { |
40 protected: | 40 protected: |
41 OperationRegistryTest() | 41 OperationRegistryTest() |
42 : ui_thread_(content::BrowserThread::UI, &message_loop_) { | 42 : ui_thread_(content::BrowserThread::UI, &message_loop_) { |
43 } | 43 } |
44 MessageLoopForUI message_loop_; | 44 base::MessageLoopForUI message_loop_; |
45 content::TestBrowserThread ui_thread_; | 45 content::TestBrowserThread ui_thread_; |
46 }; | 46 }; |
47 | 47 |
48 TEST_F(OperationRegistryTest, OneSuccess) { | 48 TEST_F(OperationRegistryTest, OneSuccess) { |
49 OperationRegistry registry; | 49 OperationRegistry registry; |
50 | 50 |
51 base::WeakPtr<MockOperation> op1 = | 51 base::WeakPtr<MockOperation> op1 = |
52 (new MockOperation(®istry))->AsWeakPtr(); | 52 (new MockOperation(®istry))->AsWeakPtr(); |
53 EXPECT_CALL(*op1, DoCancel()).Times(0); | 53 EXPECT_CALL(*op1, DoCancel()).Times(0); |
54 | 54 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 base::WeakPtr<MockOperation> op2 = | 125 base::WeakPtr<MockOperation> op2 = |
126 (new MockOperation(®istry))->AsWeakPtr(); | 126 (new MockOperation(®istry))->AsWeakPtr(); |
127 EXPECT_CALL(*op2, DoCancel()).Times(1); | 127 EXPECT_CALL(*op2, DoCancel()).Times(1); |
128 | 128 |
129 op2->NotifyResume(); | 129 op2->NotifyResume(); |
130 EXPECT_EQ(NULL, op2.get()); // deleted | 130 EXPECT_EQ(NULL, op2.get()); // deleted |
131 } | 131 } |
132 | 132 |
133 } // namespace google_apis | 133 } // namespace google_apis |
OLD | NEW |