| Index: trunk/src/chrome/test/chromedriver/commands_unittest.cc | 
| =================================================================== | 
| --- trunk/src/chrome/test/chromedriver/commands_unittest.cc	(revision 283022) | 
| +++ trunk/src/chrome/test/chromedriver/commands_unittest.cc	(working copy) | 
| @@ -546,123 +546,3 @@ | 
| ExecuteFindChildElements( | 
| 1, &session, &web_view, element_id, params, &result).code()); | 
| } | 
| - | 
| -namespace { | 
| - | 
| -class MockCommandListener : public CommandListener { | 
| - public: | 
| -  MockCommandListener() : called_(false) {} | 
| -  virtual ~MockCommandListener() {} | 
| - | 
| -  virtual Status BeforeCommand(const std::string& command_name) OVERRIDE { | 
| -    called_ = true; | 
| -    EXPECT_STREQ("cmd", command_name.c_str()); | 
| -    return Status(kOk); | 
| -  } | 
| - | 
| -  void VerifyCalled() { | 
| -    EXPECT_TRUE(called_); | 
| -  } | 
| - | 
| -  void VerifyNotCalled() { | 
| -    EXPECT_FALSE(called_); | 
| -  } | 
| - | 
| - private: | 
| -  bool called_; | 
| -}; | 
| - | 
| -Status ExecuteAddListenerToSessionCommand( | 
| -    MockCommandListener* listener, | 
| -    Session* session, | 
| -    const base::DictionaryValue& params, | 
| -    scoped_ptr<base::Value>* return_value) { | 
| -  session->command_listeners.push_back(listener); | 
| -  listener->VerifyNotCalled(); | 
| -  return Status(kOk); | 
| -} | 
| - | 
| -Status ExecuteQuitSessionCommand( | 
| -    Session* session, | 
| -    const base::DictionaryValue& params, | 
| -    scoped_ptr<base::Value>* return_value) { | 
| -  session->quit = true; | 
| -  return Status(kOk); | 
| -} | 
| - | 
| -void OnAddListenerToSessionCommand( | 
| -    MockCommandListener* listener, | 
| -    base::RunLoop* run_loop, | 
| -    const Status& status, | 
| -    scoped_ptr<base::Value> value, | 
| -    const std::string& session_id) { | 
| -  ASSERT_EQ(kOk, status.code()); | 
| -  listener->VerifyNotCalled(); | 
| -  run_loop->Quit(); | 
| -} | 
| - | 
| -void OnQuitSessionCommand( | 
| -    MockCommandListener* listener, | 
| -    base::RunLoop* run_loop, | 
| -    const Status& status, | 
| -    scoped_ptr<base::Value> value, | 
| -    const std::string& session_id) { | 
| -  ASSERT_EQ(kOk, status.code()); | 
| -  listener->VerifyCalled(); | 
| -  run_loop->Quit(); | 
| -} | 
| - | 
| -}  // namespace | 
| - | 
| -TEST(CommandsTest, SessionNotifiedOfCommand) { | 
| -  SessionThreadMap map; | 
| -  linked_ptr<base::Thread> thread(new base::Thread("1")); | 
| -  ASSERT_TRUE(thread->Start()); | 
| -  std::string id("id"); | 
| -  thread->message_loop()->PostTask( | 
| -      FROM_HERE, | 
| -      base::Bind(&internal::CreateSessionOnSessionThreadForTesting, id)); | 
| -  map[id] = thread; | 
| - | 
| -  base::DictionaryValue params; | 
| -  // |listener| is owned by and will be destroyed by |session| | 
| -  MockCommandListener* listener = new MockCommandListener(); | 
| -  SessionCommand cmd = base::Bind( | 
| -      &ExecuteAddListenerToSessionCommand, listener); | 
| - | 
| -  base::MessageLoop loop; | 
| -  base::RunLoop run_loop_addlistener; | 
| - | 
| -  // |CommandListener|s are notified immediately before commands are run. | 
| -  // Here, the command adds |listener| to the session, so |listener| | 
| -  // should not be notified since it will not have been added yet. | 
| -  ExecuteSessionCommand( | 
| -      &map, | 
| -      "cmd", | 
| -      cmd, | 
| -      false, | 
| -      params, | 
| -      id, | 
| -      base::Bind(&OnAddListenerToSessionCommand, listener, | 
| -                 &run_loop_addlistener)); | 
| - | 
| -  run_loop_addlistener.Run(); | 
| - | 
| -  base::RunLoop run_loop_testlistener; | 
| -  cmd = base::Bind( | 
| -        &ExecuteQuitSessionCommand); | 
| - | 
| -  // |listener| was added to |session| by ExecuteAddListenerToSessionCommand | 
| -  // and should be notified before the next command, ExecuteQuitSessionCommand. | 
| -  ExecuteSessionCommand( | 
| -      &map, | 
| -      "cmd", | 
| -      cmd, | 
| -      false, | 
| -      params, | 
| -      id, | 
| -      base::Bind(&OnQuitSessionCommand, listener, | 
| -                 &run_loop_testlistener)); | 
| - | 
| -  run_loop_testlistener.Run(); | 
| -} | 
|  |