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 // |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 | 840 |
841 #if defined(OS_POSIX) | 841 #if defined(OS_POSIX) |
842 class ReadonlyRlzDirectoryTest : public RlzLibTestNoMachineState { | 842 class ReadonlyRlzDirectoryTest : public RlzLibTestNoMachineState { |
843 protected: | 843 protected: |
844 void SetUp() override; | 844 void SetUp() override; |
845 }; | 845 }; |
846 | 846 |
847 void ReadonlyRlzDirectoryTest::SetUp() { | 847 void ReadonlyRlzDirectoryTest::SetUp() { |
848 RlzLibTestNoMachineState::SetUp(); | 848 RlzLibTestNoMachineState::SetUp(); |
849 // Make the rlz directory non-writeable. | 849 // Make the rlz directory non-writeable. |
850 int chmod_result = chmod(m_rlz_test_helper_.temp_dir_.path().value().c_str(), | 850 int chmod_result = |
851 0500); | 851 chmod(m_rlz_test_helper_.temp_dir_.GetPath().value().c_str(), 0500); |
852 ASSERT_EQ(0, chmod_result); | 852 ASSERT_EQ(0, chmod_result); |
853 } | 853 } |
854 | 854 |
855 TEST_F(ReadonlyRlzDirectoryTest, WriteFails) { | 855 TEST_F(ReadonlyRlzDirectoryTest, WriteFails) { |
856 // The rlz test runner runs every test twice: Once normally, and once with | 856 // The rlz test runner runs every test twice: Once normally, and once with |
857 // a SupplementaryBranding on the stack. In the latter case, the rlz lock | 857 // a SupplementaryBranding on the stack. In the latter case, the rlz lock |
858 // has already been acquired before the rlz directory got changed to | 858 // has already been acquired before the rlz directory got changed to |
859 // read-only, which makes this test pointless. So run it only in the first | 859 // read-only, which makes this test pointless. So run it only in the first |
860 // pass. | 860 // pass. |
861 if (!rlz_lib::SupplementaryBranding::GetBrand().empty()) | 861 if (!rlz_lib::SupplementaryBranding::GetBrand().empty()) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 int mkdir_result = mkdir(rlz_lib::testing::RlzStoreFilenameStr().c_str(), | 934 int mkdir_result = mkdir(rlz_lib::testing::RlzStoreFilenameStr().c_str(), |
935 0500); | 935 0500); |
936 ASSERT_EQ(0, mkdir_result); | 936 ASSERT_EQ(0, mkdir_result); |
937 | 937 |
938 rlz_lib::SupplementaryBranding branding("TEST"); | 938 rlz_lib::SupplementaryBranding branding("TEST"); |
939 EXPECT_FALSE(rlz_lib::RecordProductEvent(rlz_lib::TOOLBAR_NOTIFIER, | 939 EXPECT_FALSE(rlz_lib::RecordProductEvent(rlz_lib::TOOLBAR_NOTIFIER, |
940 rlz_lib::IE_DEFAULT_SEARCH, rlz_lib::INSTALL)); | 940 rlz_lib::IE_DEFAULT_SEARCH, rlz_lib::INSTALL)); |
941 } | 941 } |
942 | 942 |
943 #endif | 943 #endif |
OLD | NEW |