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 <time.h> | 5 #include <time.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 if (run_in_thread_) { | 101 if (run_in_thread_) { |
102 DCHECK(!run_in_loop_); | 102 DCHECK(!run_in_loop_); |
103 expected_loop = run_in_thread_->message_loop(); | 103 expected_loop = run_in_thread_->message_loop(); |
104 } else if (run_in_loop_) { | 104 } else if (run_in_loop_) { |
105 expected_loop = run_in_loop_; | 105 expected_loop = run_in_loop_; |
106 } | 106 } |
107 ASSERT_TRUE(expected_loop != NULL); | 107 ASSERT_TRUE(expected_loop != NULL); |
108 | 108 |
109 did_run_ = true; | 109 did_run_ = true; |
110 EXPECT_EQ(expected_loop, MessageLoop::current()); | 110 EXPECT_EQ(expected_loop, MessageLoop::current()); |
111 loop_to_quit_->PostTask(FROM_HERE, new MessageLoop::QuitTask); | 111 loop_to_quit_->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
112 } | 112 } |
113 | 113 |
114 private: | 114 private: |
115 bool did_run_; | 115 bool did_run_; |
116 Thread* run_in_thread_; | 116 Thread* run_in_thread_; |
117 MessageLoop* run_in_loop_; | 117 MessageLoop* run_in_loop_; |
118 MessageLoop* parent_loop_; | 118 MessageLoop* parent_loop_; |
119 MessageLoop* loop_to_quit_; | 119 MessageLoop* loop_to_quit_; |
120 }; | 120 }; |
121 | 121 |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 }; | 946 }; |
947 | 947 |
948 class MockDeleteCookieCallback | 948 class MockDeleteCookieCallback |
949 : public MockCookieCallback<MockDeleteCookieCallback, | 949 : public MockCookieCallback<MockDeleteCookieCallback, |
950 CookieMonster::DeleteCookieCallback> { | 950 CookieMonster::DeleteCookieCallback> { |
951 public: | 951 public: |
952 MOCK_METHOD1(Invoke, void(bool success)); | 952 MOCK_METHOD1(Invoke, void(bool success)); |
953 }; | 953 }; |
954 | 954 |
955 ACTION(QuitCurrentMessageLoop) { | 955 ACTION(QuitCurrentMessageLoop) { |
956 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 956 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
957 } | 957 } |
958 | 958 |
959 // TODO(erikwright): When the synchronous helpers 'GetCookies' etc. are removed, | 959 // TODO(erikwright): When the synchronous helpers 'GetCookies' etc. are removed, |
960 // rename these, removing the 'Action' suffix. | 960 // rename these, removing the 'Action' suffix. |
961 ACTION_P4(DeleteCookieAction, cookie_monster, url, name, callback) { | 961 ACTION_P4(DeleteCookieAction, cookie_monster, url, name, callback) { |
962 cookie_monster->DeleteCookieAsync(url, name, callback->AsCallback()); | 962 cookie_monster->DeleteCookieAsync(url, name, callback->AsCallback()); |
963 } | 963 } |
964 ACTION_P3(GetCookiesAction, cookie_monster, url, callback) { | 964 ACTION_P3(GetCookiesAction, cookie_monster, url, callback) { |
965 cookie_monster->GetCookiesWithOptionsAsync( | 965 cookie_monster->GetCookiesWithOptionsAsync( |
966 url, CookieOptions(), callback->AsCallback()); | 966 url, CookieOptions(), callback->AsCallback()); |
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3611 // Delete the cookie. | 3611 // Delete the cookie. |
3612 DeleteCookie(cm, url_google_, "A"); | 3612 DeleteCookie(cm, url_google_, "A"); |
3613 EXPECT_EQ("", GetCookies(cm, url_google_)); | 3613 EXPECT_EQ("", GetCookies(cm, url_google_)); |
3614 EXPECT_EQ(4u, store->commands().size()); | 3614 EXPECT_EQ(4u, store->commands().size()); |
3615 EXPECT_EQ(CookieStoreCommand::REMOVE, store->commands()[3].type); | 3615 EXPECT_EQ(CookieStoreCommand::REMOVE, store->commands()[3].type); |
3616 EXPECT_EQ("A", store->commands()[3].cookie.Name()); | 3616 EXPECT_EQ("A", store->commands()[3].cookie.Name()); |
3617 EXPECT_EQ("C", store->commands()[3].cookie.Value()); | 3617 EXPECT_EQ("C", store->commands()[3].cookie.Value()); |
3618 } | 3618 } |
3619 | 3619 |
3620 } // namespace net | 3620 } // namespace net |
OLD | NEW |