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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return CloudPrintURLFetcher::STOP_PROCESSING; | 106 return CloudPrintURLFetcher::STOP_PROCESSING; |
107 } | 107 } |
108 | 108 |
109 std::string GetAuthHeader() override { return std::string(); } | 109 std::string GetAuthHeader() override { return std::string(); } |
110 | 110 |
111 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy() { | 111 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy() { |
112 return io_message_loop_proxy_; | 112 return io_message_loop_proxy_; |
113 } | 113 } |
114 | 114 |
115 protected: | 115 protected: |
116 virtual void SetUp() { | 116 void SetUp() override { |
117 testing::Test::SetUp(); | 117 testing::Test::SetUp(); |
118 | 118 |
119 io_message_loop_proxy_ = base::MessageLoopProxy::current(); | 119 io_message_loop_proxy_ = base::MessageLoopProxy::current(); |
120 } | 120 } |
121 | 121 |
122 virtual void TearDown() { | 122 void TearDown() override { |
123 fetcher_ = NULL; | 123 fetcher_ = NULL; |
124 // Deleting the fetcher causes a task to be posted to the IO thread to | 124 // Deleting the fetcher causes a task to be posted to the IO thread to |
125 // release references to the URLRequestContextGetter. We need to run all | 125 // release references to the URLRequestContextGetter. We need to run all |
126 // pending tasks to execute that (this is the IO thread). | 126 // pending tasks to execute that (this is the IO thread). |
127 base::MessageLoop::current()->RunUntilIdle(); | 127 base::MessageLoop::current()->RunUntilIdle(); |
128 EXPECT_EQ(0, g_request_context_getter_instances); | 128 EXPECT_EQ(0, g_request_context_getter_instances); |
129 } | 129 } |
130 | 130 |
131 // URLFetcher is designed to run on the main UI thread, but in our tests | 131 // URLFetcher is designed to run on the main UI thread, but in our tests |
132 // we assume that the current thread is the IO thread where the URLFetcher | 132 // we assume that the current thread is the IO thread where the URLFetcher |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 base::FilePath(kDocRoot)); | 368 base::FilePath(kDocRoot)); |
369 ASSERT_TRUE(test_server.Start()); | 369 ASSERT_TRUE(test_server.Start()); |
370 | 370 |
371 GURL url(test_server.GetURL("defaultresponse")); | 371 GURL url(test_server.GetURL("defaultresponse")); |
372 CreateFetcher(url, 11); | 372 CreateFetcher(url, 11); |
373 | 373 |
374 base::MessageLoop::current()->Run(); | 374 base::MessageLoop::current()->Run(); |
375 } | 375 } |
376 | 376 |
377 } // namespace cloud_print | 377 } // namespace cloud_print |
OLD | NEW |