| OLD | NEW | 
|    1 // Copyright 2014 The Chromium Authors. All rights reserved. |    1 // Copyright 2014 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 #include "base/command_line.h" |    5 #include "base/command_line.h" | 
|    6 #include "base/location.h" |    6 #include "base/location.h" | 
|    7 #include "base/message_loop/message_loop.h" |    7 #include "base/message_loop/message_loop.h" | 
|    8 #include "base/single_thread_task_runner.h" |    8 #include "base/single_thread_task_runner.h" | 
|    9 #include "base/threading/thread_task_runner_handle.h" |    9 #include "base/threading/thread_task_runner_handle.h" | 
|   10 #include "chrome/browser/browser_process.h" |   10 #include "chrome/browser/browser_process.h" | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|   36   out->push_back("xkb:us:dvp:eng"); |   36   out->push_back("xkb:us:dvp:eng"); | 
|   37   out->push_back("xkb:us:colemak:eng"); |   37   out->push_back("xkb:us:colemak:eng"); | 
|   38   out->push_back("xkb:us:workman:eng"); |   38   out->push_back("xkb:us:workman:eng"); | 
|   39   out->push_back("xkb:us:workman-intl:eng"); |   39   out->push_back("xkb:us:workman-intl:eng"); | 
|   40   chromeos::input_method::InputMethodManager::Get()->MigrateInputMethods(out); |   40   chromeos::input_method::InputMethodManager::Get()->MigrateInputMethods(out); | 
|   41 } |   41 } | 
|   42  |   42  | 
|   43 class FocusPODWaiter { |   43 class FocusPODWaiter { | 
|   44  public: |   44  public: | 
|   45   FocusPODWaiter() : focused_(false), runner_(new content::MessageLoopRunner) { |   45   FocusPODWaiter() : focused_(false), runner_(new content::MessageLoopRunner) { | 
|   46     GetOobeUI() |   46     GetOobeUI()->signin_screen_handler()->SetFocusPODCallbackForTesting( | 
|   47         ->signin_screen_handler_for_test() |   47         base::Bind(&FocusPODWaiter::OnFocusPOD, base::Unretained(this))); | 
|   48         ->SetFocusPODCallbackForTesting( |  | 
|   49             base::Bind(&FocusPODWaiter::OnFocusPOD, base::Unretained(this))); |  | 
|   50   } |   48   } | 
|   51   ~FocusPODWaiter() { |   49   ~FocusPODWaiter() { | 
|   52     GetOobeUI() |   50     GetOobeUI()->signin_screen_handler()->SetFocusPODCallbackForTesting( | 
|   53         ->signin_screen_handler_for_test() |   51         base::Closure()); | 
|   54         ->SetFocusPODCallbackForTesting(base::Closure()); |  | 
|   55   } |   52   } | 
|   56  |   53  | 
|   57   void OnFocusPOD() { |   54   void OnFocusPOD() { | 
|   58     ASSERT_TRUE(base::MessageLoopForUI::IsCurrent()); |   55     ASSERT_TRUE(base::MessageLoopForUI::IsCurrent()); | 
|   59     focused_ = true; |   56     focused_ = true; | 
|   60     if (runner_.get()) { |   57     if (runner_.get()) { | 
|   61       base::ThreadTaskRunnerHandle::Get()->PostTask( |   58       base::ThreadTaskRunnerHandle::Get()->PostTask( | 
|   62           FROM_HERE, |   59           FROM_HERE, | 
|   63           base::Bind(&FocusPODWaiter::ExitMessageLoop, base::Unretained(this))); |   60           base::Bind(&FocusPODWaiter::ExitMessageLoop, base::Unretained(this))); | 
|   64     } |   61     } | 
|   65   } |   62   } | 
|   66  |   63  | 
|   67   void ExitMessageLoop() { runner_->Quit(); } |   64   void ExitMessageLoop() { runner_->Quit(); } | 
|   68  |   65  | 
|   69   void Wait() { |   66   void Wait() { | 
|   70     if (focused_) |   67     if (focused_) | 
|   71       return; |   68       return; | 
|   72     runner_->Run(); |   69     runner_->Run(); | 
|   73     GetOobeUI() |   70     GetOobeUI()->signin_screen_handler()->SetFocusPODCallbackForTesting( | 
|   74         ->signin_screen_handler_for_test() |   71         base::Closure()); | 
|   75         ->SetFocusPODCallbackForTesting(base::Closure()); |  | 
|   76     runner_ = NULL; |   72     runner_ = NULL; | 
|   77   } |   73   } | 
|   78  |   74  | 
|   79  private: |   75  private: | 
|   80   OobeUI* GetOobeUI() { |   76   OobeUI* GetOobeUI() { | 
|   81     OobeUI* oobe_ui = LoginDisplayHost::default_host()->GetOobeUI(); |   77     OobeUI* oobe_ui = LoginDisplayHost::default_host()->GetOobeUI(); | 
|   82     CHECK(oobe_ui); |   78     CHECK(oobe_ui); | 
|   83     return oobe_ui; |   79     return oobe_ui; | 
|   84   } |   80   } | 
|   85  |   81  | 
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  277   // Switch back. |  273   // Switch back. | 
|  278   js_checker().Evaluate("$('gaia-signin').cancel()"); |  274   js_checker().Evaluate("$('gaia-signin').cancel()"); | 
|  279   OobeScreenWaiter(OobeScreen::SCREEN_ACCOUNT_PICKER).Wait(); |  275   OobeScreenWaiter(OobeScreen::SCREEN_ACCOUNT_PICKER).Wait(); | 
|  280  |  276  | 
|  281   EXPECT_EQ(expected_input_methods, |  277   EXPECT_EQ(expected_input_methods, | 
|  282             input_method::InputMethodManager::Get() |  278             input_method::InputMethodManager::Get() | 
|  283                 ->GetActiveIMEState() |  279                 ->GetActiveIMEState() | 
|  284                 ->GetActiveInputMethodIds()); |  280                 ->GetActiveInputMethodIds()); | 
|  285 } |  281 } | 
|  286 }  // namespace chromeos |  282 }  // namespace chromeos | 
| OLD | NEW |