OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/thread.h" | 5 #include "base/thread.h" |
6 #include "base/time.h" | 6 #include "base/time.h" |
7 #include "chrome/browser/url_fetcher.h" | 7 #include "chrome/browser/url_fetcher.h" |
8 #include "chrome/browser/url_fetcher_protect.h" | 8 #include "chrome/browser/url_fetcher_protect.h" |
9 #include "net/url_request/url_request_unittest.h" | 9 #include "net/url_request/url_request_unittest.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
| 12 using base::Time; |
| 13 using base::TimeDelta; |
| 14 |
12 namespace { | 15 namespace { |
13 | 16 |
14 const wchar_t kDocRoot[] = L"chrome/test/data"; | 17 const wchar_t kDocRoot[] = L"chrome/test/data"; |
15 const char kHostName[] = "127.0.0.1"; | 18 const char kHostName[] = "127.0.0.1"; |
16 const int kBadHTTPSPort = 9666; | 19 const int kBadHTTPSPort = 9666; |
17 | 20 |
18 class URLFetcherTest : public testing::Test, public URLFetcher::Delegate { | 21 class URLFetcherTest : public testing::Test, public URLFetcher::Delegate { |
19 public: | 22 public: |
20 URLFetcherTest() : fetcher_(NULL) { } | 23 URLFetcherTest() : fetcher_(NULL) { } |
21 | 24 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // (main) thread will do the IO, and when the fetch is complete it will | 433 // (main) thread will do the IO, and when the fetch is complete it will |
431 // terminate the main thread's message loop; then the other thread's | 434 // terminate the main thread's message loop; then the other thread's |
432 // message loop will be shut down automatically as the thread goes out of | 435 // message loop will be shut down automatically as the thread goes out of |
433 // scope. | 436 // scope. |
434 base::Thread t("URLFetcher test thread"); | 437 base::Thread t("URLFetcher test thread"); |
435 t.Start(); | 438 t.Start(); |
436 t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this, url)); | 439 t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this, url)); |
437 | 440 |
438 MessageLoop::current()->Run(); | 441 MessageLoop::current()->Run(); |
439 } | 442 } |
OLD | NEW |