DevTools: cut host and port from webSocketDebuggerUrl in addition to ws:// prefix
[chromium-blink-merge.git] / net / cookies / cookie_store_test_callbacks.cc
blobafb05d1514642912a41697d9a7498690709d8f3c
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
3 // found in the LICENSE file.
5 #include "net/cookies/cookie_store_test_callbacks.h"
7 #include "base/location.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 namespace net {
15 CookieCallback::CookieCallback(base::Thread* run_in_thread)
16 : did_run_(false),
17 run_in_thread_(run_in_thread),
18 run_in_loop_(NULL),
19 parent_loop_(base::MessageLoop::current()),
20 loop_to_quit_(base::MessageLoop::current()) {}
22 CookieCallback::CookieCallback()
23 : did_run_(false),
24 run_in_thread_(NULL),
25 run_in_loop_(base::MessageLoop::current()),
26 parent_loop_(NULL),
27 loop_to_quit_(base::MessageLoop::current()) {}
29 void CookieCallback::CallbackEpilogue() {
30 base::MessageLoop* expected_loop = NULL;
31 if (run_in_thread_) {
32 DCHECK(!run_in_loop_);
33 expected_loop = run_in_thread_->message_loop();
34 } else if (run_in_loop_) {
35 expected_loop = run_in_loop_;
37 ASSERT_TRUE(expected_loop != NULL);
39 did_run_ = true;
40 EXPECT_EQ(expected_loop, base::MessageLoop::current());
41 loop_to_quit_->task_runner()->PostTask(FROM_HERE,
42 base::MessageLoop::QuitClosure());
45 StringResultCookieCallback::StringResultCookieCallback() {}
46 StringResultCookieCallback::StringResultCookieCallback(
47 base::Thread* run_in_thread)
48 : CookieCallback(run_in_thread) {}
50 NoResultCookieCallback::NoResultCookieCallback() {}
51 NoResultCookieCallback::NoResultCookieCallback(base::Thread* run_in_thread)
52 : CookieCallback(run_in_thread) {}
54 } // namespace net