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

Side by Side Diff: ceee/ie/broker/cookie_api_module_unittest.cc

Issue 6300001: Clang: enable -Wbool-conversions and -Wunused-variables on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, undo indent Created 9 years, 11 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 | « build/common.gypi ('k') | chrome/browser/extensions/extension_prefs_unittest.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Cookie API implementation unit tests. 5 // Cookie API implementation unit tests.
6 6
7 // MockWin32 can't be included after ChromeFrameHost because of an include 7 // MockWin32 can't be included after ChromeFrameHost because of an include
8 // incompatibility with atlwin.h. 8 // incompatibility with atlwin.h.
9 #include "ceee/testing/utils/mock_win32.h" // NOLINT 9 #include "ceee/testing/utils/mock_win32.h" // NOLINT
10 10
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 PostError(StrEq("Not implemented."))).Times(1); 949 PostError(StrEq("Not implemented."))).Times(1);
950 invocation.Execute(args, kRequestId); 950 invocation.Execute(args, kRequestId);
951 } 951 }
952 952
953 TEST_F(CookieApiTests, CookieChangedEventHandler) { 953 TEST_F(CookieApiTests, CookieChangedEventHandler) {
954 testing::LogDisabler no_dchecks; 954 testing::LogDisabler no_dchecks;
955 MockCookieChanged cookie_changed; 955 MockCookieChanged cookie_changed;
956 std::string converted_args; 956 std::string converted_args;
957 // Empty args. 957 // Empty args.
958 std::string input_args = ""; 958 std::string input_args = "";
959 EXPECT_EQ(false, 959 EXPECT_FALSE(cookie_changed.EventHandlerImpl(input_args, &converted_args));
960 cookie_changed.EventHandlerImpl(input_args, &converted_args));
961 // Invalid args. 960 // Invalid args.
962 input_args = "[false, {hello]"; 961 input_args = "[false, {hello]";
963 EXPECT_EQ(false, 962 EXPECT_FALSE(cookie_changed.EventHandlerImpl(input_args, &converted_args));
964 cookie_changed.EventHandlerImpl(input_args, &converted_args));
965 input_args = "[3]"; 963 input_args = "[3]";
966 EXPECT_EQ(false, 964 EXPECT_FALSE(cookie_changed.EventHandlerImpl(input_args, &converted_args));
967 cookie_changed.EventHandlerImpl(input_args, &converted_args));
968 // Valid args. 965 // Valid args.
969 input_args = "[{\"removed\": false, \"cookie\": {\"storeId\": \"1\"}}]"; 966 input_args = "[{\"removed\": false, \"cookie\": {\"storeId\": \"1\"}}]";
970 967
971 // Invalid store ID. 968 // Invalid store ID.
972 cookie_changed.AllocateApiResult(); 969 cookie_changed.AllocateApiResult();
973 EXPECT_CALL(*cookie_changed.api_result_, 970 EXPECT_CALL(*cookie_changed.api_result_,
974 GetAnyWindowInStore(StrEq("1"), true, _, _)) 971 GetAnyWindowInStore(StrEq("1"), true, _, _))
975 .WillOnce(Return(false)); 972 .WillOnce(Return(false));
976 EXPECT_EQ(false, 973 EXPECT_FALSE(cookie_changed.EventHandlerImpl(input_args, &converted_args));
977 cookie_changed.EventHandlerImpl(input_args, &converted_args));
978 974
979 // Cookie store access errors. 975 // Cookie store access errors.
980 cookie_changed.AllocateApiResult(); 976 cookie_changed.AllocateApiResult();
981 EXPECT_CALL(*cookie_changed.api_result_, 977 EXPECT_CALL(*cookie_changed.api_result_,
982 GetAnyWindowInStore(StrEq("1"), true, _, _)) 978 GetAnyWindowInStore(StrEq("1"), true, _, _))
983 .WillOnce(DoAll(SetArgumentPointee<2>(HWND(5)), 979 .WillOnce(DoAll(SetArgumentPointee<2>(HWND(5)),
984 SetArgumentPointee<3>(false), 980 SetArgumentPointee<3>(false),
985 Return(true))); 981 Return(true)));
986 EXPECT_CALL(*cookie_changed.api_result_, 982 EXPECT_CALL(*cookie_changed.api_result_,
987 CookieStoreIsRegistered(HWND(5))).WillOnce(Return(E_FAIL)); 983 CookieStoreIsRegistered(HWND(5))).WillOnce(Return(E_FAIL));
988 EXPECT_EQ(false, 984 EXPECT_FALSE(cookie_changed.EventHandlerImpl(input_args, &converted_args));
989 cookie_changed.EventHandlerImpl(input_args, &converted_args));
990 985
991 cookie_changed.AllocateApiResult(); 986 cookie_changed.AllocateApiResult();
992 EXPECT_CALL(*cookie_changed.api_result_, 987 EXPECT_CALL(*cookie_changed.api_result_,
993 GetAnyWindowInStore(StrEq("1"), true, _, _)) 988 GetAnyWindowInStore(StrEq("1"), true, _, _))
994 .WillOnce(DoAll(SetArgumentPointee<2>(HWND(5)), 989 .WillOnce(DoAll(SetArgumentPointee<2>(HWND(5)),
995 SetArgumentPointee<3>(false), 990 SetArgumentPointee<3>(false),
996 Return(true))); 991 Return(true)));
997 EXPECT_CALL(*cookie_changed.api_result_, 992 EXPECT_CALL(*cookie_changed.api_result_,
998 CookieStoreIsRegistered(HWND(5))).WillOnce(Return(S_FALSE)); 993 CookieStoreIsRegistered(HWND(5))).WillOnce(Return(S_FALSE));
999 EXPECT_CALL(*cookie_changed.api_result_, 994 EXPECT_CALL(*cookie_changed.api_result_,
1000 RegisterCookieStore(HWND(5))).WillOnce(Return(E_FAIL)); 995 RegisterCookieStore(HWND(5))).WillOnce(Return(E_FAIL));
1001 EXPECT_EQ(false, 996 EXPECT_FALSE(cookie_changed.EventHandlerImpl(input_args, &converted_args));
1002 cookie_changed.EventHandlerImpl(input_args, &converted_args));
1003 997
1004 // Registered cookie store. 998 // Registered cookie store.
1005 cookie_changed.AllocateApiResult(); 999 cookie_changed.AllocateApiResult();
1006 EXPECT_CALL(*cookie_changed.api_result_, 1000 EXPECT_CALL(*cookie_changed.api_result_,
1007 GetAnyWindowInStore(StrEq("1"), true, _, _)) 1001 GetAnyWindowInStore(StrEq("1"), true, _, _))
1008 .WillOnce(DoAll(SetArgumentPointee<2>(HWND(5)), 1002 .WillOnce(DoAll(SetArgumentPointee<2>(HWND(5)),
1009 SetArgumentPointee<3>(false), 1003 SetArgumentPointee<3>(false),
1010 Return(true))); 1004 Return(true)));
1011 EXPECT_CALL(*cookie_changed.api_result_, 1005 EXPECT_CALL(*cookie_changed.api_result_,
1012 CookieStoreIsRegistered(HWND(5))).WillOnce(Return(S_OK)); 1006 CookieStoreIsRegistered(HWND(5))).WillOnce(Return(S_OK));
1013 EXPECT_EQ(true, 1007 EXPECT_TRUE(cookie_changed.EventHandlerImpl(input_args, &converted_args));
1014 cookie_changed.EventHandlerImpl(input_args, &converted_args));
1015 1008
1016 // Unregistered cookie store. 1009 // Unregistered cookie store.
1017 cookie_changed.AllocateApiResult(); 1010 cookie_changed.AllocateApiResult();
1018 EXPECT_CALL(*cookie_changed.api_result_, 1011 EXPECT_CALL(*cookie_changed.api_result_,
1019 GetAnyWindowInStore(StrEq("1"), true, _, _)) 1012 GetAnyWindowInStore(StrEq("1"), true, _, _))
1020 .WillOnce(DoAll(SetArgumentPointee<2>(HWND(5)), 1013 .WillOnce(DoAll(SetArgumentPointee<2>(HWND(5)),
1021 SetArgumentPointee<3>(false), 1014 SetArgumentPointee<3>(false),
1022 Return(true))); 1015 Return(true)));
1023 EXPECT_CALL(*cookie_changed.api_result_, 1016 EXPECT_CALL(*cookie_changed.api_result_,
1024 CookieStoreIsRegistered(HWND(5))).WillOnce(Return(S_FALSE)); 1017 CookieStoreIsRegistered(HWND(5))).WillOnce(Return(S_FALSE));
1025 EXPECT_CALL(*cookie_changed.api_result_, 1018 EXPECT_CALL(*cookie_changed.api_result_,
1026 RegisterCookieStore(HWND(5))).WillOnce(Return(S_OK)); 1019 RegisterCookieStore(HWND(5))).WillOnce(Return(S_OK));
1027 EXPECT_EQ(true, 1020 EXPECT_TRUE(cookie_changed.EventHandlerImpl(input_args, &converted_args));
1028 cookie_changed.EventHandlerImpl(input_args, &converted_args));
1029 } 1021 }
1030 1022
1031 } // namespace 1023 } // namespace
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | chrome/browser/extensions/extension_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698