OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/safe_browsing/two_phase_uploader.h" | 5 #include "chrome/browser/safe_browsing/two_phase_uploader.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chrome/browser/safe_browsing/local_two_phase_testserver.h" | 9 #include "chrome/browser/safe_browsing/local_two_phase_testserver.h" |
10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
11 #include "content/public/test/test_utils.h" | 11 #include "content/public/test/test_utils.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 #include "net/url_request/url_fetcher.h" | 13 #include "net/url_request/url_fetcher.h" |
14 #include "net/url_request/url_request_test_util.h" | 14 #include "net/url_request/url_request_test_util.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 using content::BrowserThread; | 17 using content::BrowserThread; |
18 using content::MessageLoopRunner; | 18 using content::MessageLoopRunner; |
19 | 19 |
| 20 namespace safe_browsing { |
| 21 |
20 namespace { | 22 namespace { |
21 | 23 |
22 class Delegate { | 24 class Delegate { |
23 public: | 25 public: |
24 Delegate() : state_(TwoPhaseUploader::STATE_NONE) { | 26 Delegate() : state_(TwoPhaseUploader::STATE_NONE) { |
25 } | 27 } |
26 | 28 |
27 void ProgressCallback(int64 current, int64 total) {} | 29 void ProgressCallback(int64 current, int64 total) {} |
28 | 30 |
29 void FinishCallback(scoped_refptr<MessageLoopRunner> runner, | 31 void FinishCallback(scoped_refptr<MessageLoopRunner> runner, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 base::Bind(&Delegate::ProgressCallback, base::Unretained(&delegate)), | 182 base::Bind(&Delegate::ProgressCallback, base::Unretained(&delegate)), |
181 base::Bind( | 183 base::Bind( |
182 &Delegate::FinishCallback, base::Unretained(&delegate), runner))); | 184 &Delegate::FinishCallback, base::Unretained(&delegate), runner))); |
183 uploader->Start(); | 185 uploader->Start(); |
184 runner->Run(); | 186 runner->Run(); |
185 EXPECT_EQ(TwoPhaseUploader::UPLOAD_FILE, delegate.state_); | 187 EXPECT_EQ(TwoPhaseUploader::UPLOAD_FILE, delegate.state_); |
186 EXPECT_EQ(net::ERR_EMPTY_RESPONSE, delegate.net_error_); | 188 EXPECT_EQ(net::ERR_EMPTY_RESPONSE, delegate.net_error_); |
187 EXPECT_EQ(net::URLFetcher::RESPONSE_CODE_INVALID, delegate.response_code_); | 189 EXPECT_EQ(net::URLFetcher::RESPONSE_CODE_INVALID, delegate.response_code_); |
188 EXPECT_EQ("", delegate.response_); | 190 EXPECT_EQ("", delegate.response_); |
189 } | 191 } |
| 192 |
| 193 } // namespace safe_browsing |
OLD | NEW |