Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: test/ConsoleJsObject.cpp

Issue 4949583905947648: Issue 1280 - Update v8, the second part (Closed)
Patch Set: Created Oct. 27, 2014, 10:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/WebRequestJsObject.cpp ('k') | test/JsEngine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 17 matching lines...) Expand all
28 28
29 void operator()(AdblockPlus::LogSystem::LogLevel logLevel, 29 void operator()(AdblockPlus::LogSystem::LogLevel logLevel,
30 const std::string& message, const std::string& source) 30 const std::string& message, const std::string& source)
31 { 31 {
32 lastLogLevel = logLevel; 32 lastLogLevel = logLevel;
33 lastMessage = message; 33 lastMessage = message;
34 lastSource = source; 34 lastSource = source;
35 } 35 }
36 }; 36 };
37 37
38 typedef std::tr1::shared_ptr<MockLogSystem> MockLogSystemPtr;
39
40 class ConsoleJsObjectTest : public BaseJsTest 38 class ConsoleJsObjectTest : public BaseJsTest
41 { 39 {
42 protected: 40 protected:
43 MockLogSystemPtr mockLogSystem; 41 std::shared_ptr<MockLogSystem> mockLogSystem;
44 42
45 void SetUp() 43 void SetUp() override
46 { 44 {
47 BaseJsTest::SetUp(); 45 BaseJsTest::SetUp();
48 mockLogSystem = MockLogSystemPtr(new MockLogSystem); 46 mockLogSystem = std::make_shared<MockLogSystem>();
49 jsEngine->SetLogSystem(mockLogSystem); 47 jsEngine->SetLogSystem(mockLogSystem);
50 } 48 }
51 }; 49 };
52 } 50 }
53 51
54 TEST_F(ConsoleJsObjectTest, ConsoleLogCall) 52 TEST_F(ConsoleJsObjectTest, ConsoleLogCall)
55 { 53 {
56 jsEngine->Evaluate("\n\nconsole.log('foo', 'bar');\n\n", "eval"); 54 jsEngine->Evaluate("\n\nconsole.log('foo', 'bar');\n\n", "eval");
57 ASSERT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_LOG, mockLogSystem->lastLogLevel); 55 ASSERT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_LOG, mockLogSystem->lastLogLevel);
58 ASSERT_EQ("foo bar", mockLogSystem->lastMessage); 56 ASSERT_EQ("foo bar", mockLogSystem->lastMessage);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 })();\n\ 99 })();\n\
102 }\n\ 100 }\n\
103 foo();", "eval"); 101 foo();", "eval");
104 ASSERT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_TRACE, mockLogSystem->lastLogLevel ); 102 ASSERT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_TRACE, mockLogSystem->lastLogLevel );
105 ASSERT_EQ("\ 103 ASSERT_EQ("\
106 1: /* anonymous */() at eval:5\n\ 104 1: /* anonymous */() at eval:5\n\
107 2: foo() at eval:6\n\ 105 2: foo() at eval:6\n\
108 3: /* anonymous */() at eval:8\n", mockLogSystem->lastMessage); 106 3: /* anonymous */() at eval:8\n", mockLogSystem->lastMessage);
109 ASSERT_EQ("", mockLogSystem->lastSource); 107 ASSERT_EQ("", mockLogSystem->lastSource);
110 } 108 }
OLDNEW
« no previous file with comments | « src/WebRequestJsObject.cpp ('k') | test/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld