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 // 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> |
| 19 |
18 #include "base/logging.h" | 20 #include "base/logging.h" |
19 #include "base/memory/scoped_ptr.h" | |
20 #include "base/posix/eintr_wrapper.h" | 21 #include "base/posix/eintr_wrapper.h" |
21 #include "build/build_config.h" | 22 #include "build/build_config.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 | 25 |
25 #include "rlz/lib/financial_ping.h" | 26 #include "rlz/lib/financial_ping.h" |
26 #include "rlz/lib/rlz_lib.h" | 27 #include "rlz/lib/rlz_lib.h" |
27 #include "rlz/lib/rlz_value_store.h" | 28 #include "rlz/lib/rlz_value_store.h" |
28 #include "rlz/test/rlz_test_helpers.h" | 29 #include "rlz/test/rlz_test_helpers.h" |
29 | 30 |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 EXPECT_STREQ("GdbRlzValue", cgi); | 568 EXPECT_STREQ("GdbRlzValue", cgi); |
568 | 569 |
569 EXPECT_FALSE(rlz_lib::GetProductEventsAsCgi(rlz_lib::TOOLBAR_NOTIFIER, | 570 EXPECT_FALSE(rlz_lib::GetProductEventsAsCgi(rlz_lib::TOOLBAR_NOTIFIER, |
570 cgi, 2048)); | 571 cgi, 2048)); |
571 EXPECT_STREQ("", cgi); | 572 EXPECT_STREQ("", cgi); |
572 } | 573 } |
573 | 574 |
574 #if defined(OS_WIN) | 575 #if defined(OS_WIN) |
575 template<class T> | 576 template<class T> |
576 class typed_buffer_ptr { | 577 class typed_buffer_ptr { |
577 scoped_ptr<char[]> buffer_; | 578 std::unique_ptr<char[]> buffer_; |
578 | 579 |
579 public: | 580 public: |
580 typed_buffer_ptr() { | 581 typed_buffer_ptr() { |
581 } | 582 } |
582 | 583 |
583 explicit typed_buffer_ptr(size_t size) : buffer_(new char[size]) { | 584 explicit typed_buffer_ptr(size_t size) : buffer_(new char[size]) { |
584 } | 585 } |
585 | 586 |
586 void reset(size_t size) { | 587 void reset(size_t size) { |
587 buffer_.reset(new char[size]); | 588 buffer_.reset(new char[size]); |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 int mkdir_result = mkdir(rlz_lib::testing::RlzStoreFilenameStr().c_str(), | 935 int mkdir_result = mkdir(rlz_lib::testing::RlzStoreFilenameStr().c_str(), |
935 0500); | 936 0500); |
936 ASSERT_EQ(0, mkdir_result); | 937 ASSERT_EQ(0, mkdir_result); |
937 | 938 |
938 rlz_lib::SupplementaryBranding branding("TEST"); | 939 rlz_lib::SupplementaryBranding branding("TEST"); |
939 EXPECT_FALSE(rlz_lib::RecordProductEvent(rlz_lib::TOOLBAR_NOTIFIER, | 940 EXPECT_FALSE(rlz_lib::RecordProductEvent(rlz_lib::TOOLBAR_NOTIFIER, |
940 rlz_lib::IE_DEFAULT_SEARCH, rlz_lib::INSTALL)); | 941 rlz_lib::IE_DEFAULT_SEARCH, rlz_lib::INSTALL)); |
941 } | 942 } |
942 | 943 |
943 #endif | 944 #endif |
OLD | NEW |