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