Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: rlz/lib/rlz_lib_test.cc

Issue 2084913004: Remove calls to deprecated MessageLoop methods in rlz. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // A test application for the RLZ library. 5 // A test application for the RLZ library.
6 // 6 //
7 // These tests should not be executed on the build server: 7 // These tests should not be executed on the build server:
8 // - They assert for the failed cases. 8 // - They assert for the failed cases.
9 // - They modify machine state (registry). 9 // - They modify machine state (registry).
10 // 10 //
11 // These tests require write access to HKLM and HKCU. 11 // These tests require write access to HKLM and HKCU.
12 // 12 //
13 // The "GGLA" brand is used to test the normal code flow of the code, and the 13 // The "GGLA" brand is used to test the normal code flow of the code, and the
14 // "TEST" brand is used to test the supplementary brand code code flow. 14 // "TEST" brand is used to test the supplementary brand code code flow.
15 15
16 #include <stddef.h> 16 #include <stddef.h>
17 17
18 #include <memory> 18 #include <memory>
19 19
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "base/posix/eintr_wrapper.h" 21 #include "base/posix/eintr_wrapper.h"
22 #include "base/single_thread_task_runner.h"
22 #include "build/build_config.h" 23 #include "build/build_config.h"
23 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 26
26 #include "rlz/lib/financial_ping.h" 27 #include "rlz/lib/financial_ping.h"
27 #include "rlz/lib/rlz_lib.h" 28 #include "rlz/lib/rlz_lib.h"
28 #include "rlz/lib/rlz_value_store.h" 29 #include "rlz/lib/rlz_value_store.h"
29 #include "rlz/test/rlz_test_helpers.h" 30 #include "rlz/test/rlz_test_helpers.h"
30 31
31 #if defined(OS_WIN) 32 #if defined(OS_WIN)
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 base::mac::ScopedNSAutoreleasePool pool; 442 base::mac::ScopedNSAutoreleasePool pool;
442 #endif 443 #endif
443 444
444 base::Thread::Options options; 445 base::Thread::Options options;
445 options.message_loop_type = base::MessageLoop::TYPE_IO; 446 options.message_loop_type = base::MessageLoop::TYPE_IO;
446 447
447 base::Thread io_thread("rlz_unittest_io_thread"); 448 base::Thread io_thread("rlz_unittest_io_thread");
448 ASSERT_TRUE(io_thread.StartWithOptions(options)); 449 ASSERT_TRUE(io_thread.StartWithOptions(options));
449 450
450 scoped_refptr<net::TestURLRequestContextGetter> context = 451 scoped_refptr<net::TestURLRequestContextGetter> context =
451 new net::TestURLRequestContextGetter( 452 new net::TestURLRequestContextGetter(io_thread.task_runner());
452 io_thread.message_loop()->task_runner());
453 rlz_lib::SetURLRequestContext(context.get()); 453 rlz_lib::SetURLRequestContext(context.get());
454 454
455 URLRequestRAII set_context(context.get()); 455 URLRequestRAII set_context(context.get());
456 #endif 456 #endif
457 457
458 MachineDealCodeHelper::Clear(); 458 MachineDealCodeHelper::Clear();
459 #if defined(OS_WIN) 459 #if defined(OS_WIN)
460 EXPECT_TRUE(rlz_lib::MachineDealCode::Set("dcc_value")); 460 EXPECT_TRUE(rlz_lib::MachineDealCode::Set("dcc_value"));
461 #endif 461 #endif
462 462
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 base::mac::ScopedNSAutoreleasePool pool; 494 base::mac::ScopedNSAutoreleasePool pool;
495 #endif 495 #endif
496 496
497 base::Thread::Options options; 497 base::Thread::Options options;
498 options.message_loop_type = base::MessageLoop::TYPE_IO; 498 options.message_loop_type = base::MessageLoop::TYPE_IO;
499 499
500 base::Thread io_thread("rlz_unittest_io_thread"); 500 base::Thread io_thread("rlz_unittest_io_thread");
501 ASSERT_TRUE(io_thread.StartWithOptions(options)); 501 ASSERT_TRUE(io_thread.StartWithOptions(options));
502 502
503 scoped_refptr<net::TestURLRequestContextGetter> context = 503 scoped_refptr<net::TestURLRequestContextGetter> context =
504 new net::TestURLRequestContextGetter( 504 new net::TestURLRequestContextGetter(io_thread.task_runner());
505 io_thread.message_loop()->task_runner());
506 rlz_lib::SetURLRequestContext(context.get()); 505 rlz_lib::SetURLRequestContext(context.get());
507 506
508 URLRequestRAII set_context(context.get()); 507 URLRequestRAII set_context(context.get());
509 508
510 rlz_lib::AccessPoint points[] = 509 rlz_lib::AccessPoint points[] =
511 {rlz_lib::IETB_SEARCH_BOX, rlz_lib::NO_ACCESS_POINT, 510 {rlz_lib::IETB_SEARCH_BOX, rlz_lib::NO_ACCESS_POINT,
512 rlz_lib::NO_ACCESS_POINT}; 511 rlz_lib::NO_ACCESS_POINT};
513 rlz_lib::test::ResetSendFinancialPingInterrupted(); 512 rlz_lib::test::ResetSendFinancialPingInterrupted();
514 EXPECT_FALSE(rlz_lib::test::WasSendFinancialPingInterrupted()); 513 EXPECT_FALSE(rlz_lib::test::WasSendFinancialPingInterrupted());
515 514
516 base::MessageLoop loop; 515 base::MessageLoop loop;
517 loop.PostTask(FROM_HERE, base::Bind(&ResetContext)); 516 loop.task_runner()->PostTask(FROM_HERE, base::Bind(&ResetContext));
518 std::string request; 517 std::string request;
519 EXPECT_FALSE(rlz_lib::SendFinancialPing(rlz_lib::TOOLBAR_NOTIFIER, points, 518 EXPECT_FALSE(rlz_lib::SendFinancialPing(rlz_lib::TOOLBAR_NOTIFIER, points,
520 "swg", "GGLA", "SwgProductId1234", "en-UK", false, 519 "swg", "GGLA", "SwgProductId1234", "en-UK", false,
521 /*skip_time_check=*/true)); 520 /*skip_time_check=*/true));
522 521
523 EXPECT_TRUE(rlz_lib::test::WasSendFinancialPingInterrupted()); 522 EXPECT_TRUE(rlz_lib::test::WasSendFinancialPingInterrupted());
524 rlz_lib::test::ResetSendFinancialPingInterrupted(); 523 rlz_lib::test::ResetSendFinancialPingInterrupted();
525 } 524 }
526 #endif 525 #endif
527 526
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 int mkdir_result = mkdir(rlz_lib::testing::RlzStoreFilenameStr().c_str(), 934 int mkdir_result = mkdir(rlz_lib::testing::RlzStoreFilenameStr().c_str(),
936 0500); 935 0500);
937 ASSERT_EQ(0, mkdir_result); 936 ASSERT_EQ(0, mkdir_result);
938 937
939 rlz_lib::SupplementaryBranding branding("TEST"); 938 rlz_lib::SupplementaryBranding branding("TEST");
940 EXPECT_FALSE(rlz_lib::RecordProductEvent(rlz_lib::TOOLBAR_NOTIFIER, 939 EXPECT_FALSE(rlz_lib::RecordProductEvent(rlz_lib::TOOLBAR_NOTIFIER,
941 rlz_lib::IE_DEFAULT_SEARCH, rlz_lib::INSTALL)); 940 rlz_lib::IE_DEFAULT_SEARCH, rlz_lib::INSTALL));
942 } 941 }
943 942
944 #endif 943 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698