OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 <unistd.h> | 5 #include <unistd.h> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 #include <base/scoped_ptr.h> | 8 #include <base/scoped_ptr.h> |
9 #include <glib.h> | 9 #include <glib.h> |
10 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 332 } |
333 | 333 |
334 namespace { | 334 namespace { |
335 class FlakyHttpFetcherTestDelegate : public HttpFetcherDelegate { | 335 class FlakyHttpFetcherTestDelegate : public HttpFetcherDelegate { |
336 public: | 336 public: |
337 virtual void ReceivedBytes(HttpFetcher* fetcher, | 337 virtual void ReceivedBytes(HttpFetcher* fetcher, |
338 const char* bytes, int length) { | 338 const char* bytes, int length) { |
339 data.append(bytes, length); | 339 data.append(bytes, length); |
340 } | 340 } |
341 virtual void TransferComplete(HttpFetcher* fetcher, bool successful) { | 341 virtual void TransferComplete(HttpFetcher* fetcher, bool successful) { |
| 342 EXPECT_TRUE(successful); |
342 g_main_loop_quit(loop_); | 343 g_main_loop_quit(loop_); |
343 } | 344 } |
344 string data; | 345 string data; |
345 GMainLoop* loop_; | 346 GMainLoop* loop_; |
346 }; | 347 }; |
347 } // namespace {} | 348 } // namespace {} |
348 | 349 |
349 TYPED_TEST(HttpFetcherTest, FlakyTest) { | 350 TYPED_TEST(HttpFetcherTest, FlakyTest) { |
350 if (this->IsMock()) | 351 if (this->IsMock()) |
351 return; | 352 return; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 442 |
442 g_timeout_add(0, StartTransfer, &start_xfer_args); | 443 g_timeout_add(0, StartTransfer, &start_xfer_args); |
443 g_main_loop_run(loop); | 444 g_main_loop_run(loop); |
444 | 445 |
445 // Exiting and testing happens in the delegate | 446 // Exiting and testing happens in the delegate |
446 } | 447 } |
447 g_main_loop_unref(loop); | 448 g_main_loop_unref(loop); |
448 } | 449 } |
449 | 450 |
450 } // namespace chromeos_update_engine | 451 } // namespace chromeos_update_engine |
OLD | NEW |