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

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

Issue 10828424: mac/rlz: Remove an incorrect check (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: indent Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | rlz/lib/rlz_value_store.h » ('j') | 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 "base/eintr_wrapper.h" 16 #include "base/eintr_wrapper.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 #include "rlz/lib/rlz_lib.h" 22 #include "rlz/lib/rlz_lib.h"
23 #include "rlz/lib/rlz_value_store.h"
23 #include "rlz/test/rlz_test_helpers.h" 24 #include "rlz/test/rlz_test_helpers.h"
24 25
25 #if defined(OS_WIN) 26 #if defined(OS_WIN)
26 #include <Windows.h> 27 #include <Windows.h>
27 #include "rlz/win/lib/machine_deal.h" 28 #include "rlz/win/lib/machine_deal.h"
28 #endif 29 #endif
29 30
30 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) 31 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET)
31 #include "base/mac/scoped_nsautorelease_pool.h" 32 #include "base/mac/scoped_nsautorelease_pool.h"
32 #include "base/threading/thread.h" 33 #include "base/threading/thread.h"
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 int status; 865 int status;
865 for (size_t i = 0; i < pids.size(); ++i) { 866 for (size_t i = 0; i < pids.size(); ++i) {
866 if (HANDLE_EINTR(waitpid(pids[i], &status, 0)) != -1) 867 if (HANDLE_EINTR(waitpid(pids[i], &status, 0)) != -1)
867 EXPECT_TRUE(WIFEXITED(status) && WEXITSTATUS(status) == 0); 868 EXPECT_TRUE(WIFEXITED(status) && WEXITSTATUS(status) == 0);
868 } 869 }
869 870
870 // No child should have the lock at this point, not even the crashed ones. 871 // No child should have the lock at this point, not even the crashed ones.
871 EXPECT_TRUE(rlz_lib::RecordProductEvent(rlz_lib::TOOLBAR_NOTIFIER, 872 EXPECT_TRUE(rlz_lib::RecordProductEvent(rlz_lib::TOOLBAR_NOTIFIER,
872 rlz_lib::IE_DEFAULT_SEARCH, rlz_lib::INSTALL)); 873 rlz_lib::IE_DEFAULT_SEARCH, rlz_lib::INSTALL));
873 } 874 }
875
876 TEST_F(RlzLibTest, LockAcquistionSucceedsButPlistCannotBeCreated) {
877 // See the comment at the top of WriteFails.
878 if (!rlz_lib::SupplementaryBranding::GetBrand().empty())
879 return;
880
881 // Create a directory where the rlz file is supposed to appear. This way,
882 // the lock file can be created successfully, but creation of the rlz file
883 // itself will fail.
884 int mkdir_result = mkdir(rlz_lib::testing::RlzPlistFilenameStr().c_str(),
885 0500);
886 ASSERT_EQ(0, mkdir_result);
887
888 rlz_lib::SupplementaryBranding branding("TEST");
889 EXPECT_FALSE(rlz_lib::RecordProductEvent(rlz_lib::TOOLBAR_NOTIFIER,
890 rlz_lib::IE_DEFAULT_SEARCH, rlz_lib::INSTALL));
891 }
892
874 #endif 893 #endif
OLDNEW
« no previous file with comments | « no previous file | rlz/lib/rlz_value_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698