| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/first_run/first_run_helper.h" | 5 #include "ash/first_run/first_run_helper.h" |
| 6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
| 7 #include "ash/system/tray/system_tray.h" | 7 #include "ash/system/tray/system_tray.h" |
| 8 #include "chrome/browser/chromeos/first_run/first_run.h" | 8 #include "chrome/browser/chromeos/first_run/first_run.h" |
| 9 #include "chrome/browser/chromeos/first_run/first_run_controller.h" | 9 #include "chrome/browser/chromeos/first_run/first_run_controller.h" |
| 10 #include "chrome/browser/chromeos/first_run/step_names.h" | 10 #include "chrome/browser/chromeos/first_run/step_names.h" |
| 11 #include "chrome/browser/chromeos/login/test/js_checker.h" | 11 #include "chrome/browser/chromeos/login/test/js_checker.h" |
| 12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
| 13 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 class FirstRunUIBrowserTest : public InProcessBrowserTest, | 17 class FirstRunUIBrowserTest : public InProcessBrowserTest, |
| 18 public FirstRunActor::Delegate { | 18 public FirstRunActor::Delegate { |
| 19 public: | 19 public: |
| 20 FirstRunUIBrowserTest() | 20 FirstRunUIBrowserTest() |
| 21 : initialized_(false), | 21 : initialized_(false), |
| 22 finalized_(false) { | 22 finalized_(false) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 // FirstRunActor::Delegate overrides. | 25 // FirstRunActor::Delegate overrides. |
| 26 virtual void OnActorInitialized() OVERRIDE { | 26 virtual void OnActorInitialized() override { |
| 27 initialized_ = true; | 27 initialized_ = true; |
| 28 if (!on_initialized_callback_.is_null()) | 28 if (!on_initialized_callback_.is_null()) |
| 29 on_initialized_callback_.Run(); | 29 on_initialized_callback_.Run(); |
| 30 controller()->OnActorInitialized(); | 30 controller()->OnActorInitialized(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual void OnNextButtonClicked(const std::string& step_name) OVERRIDE { | 33 virtual void OnNextButtonClicked(const std::string& step_name) override { |
| 34 controller()->OnNextButtonClicked(step_name); | 34 controller()->OnNextButtonClicked(step_name); |
| 35 } | 35 } |
| 36 | 36 |
| 37 virtual void OnStepShown(const std::string& step_name) OVERRIDE { | 37 virtual void OnStepShown(const std::string& step_name) override { |
| 38 current_step_name_ = step_name; | 38 current_step_name_ = step_name; |
| 39 if (!on_step_shown_callback_.is_null()) | 39 if (!on_step_shown_callback_.is_null()) |
| 40 on_step_shown_callback_.Run(); | 40 on_step_shown_callback_.Run(); |
| 41 controller()->OnStepShown(step_name); | 41 controller()->OnStepShown(step_name); |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual void OnStepHidden(const std::string& step_name) OVERRIDE { | 44 virtual void OnStepHidden(const std::string& step_name) override { |
| 45 controller()->OnStepHidden(step_name); | 45 controller()->OnStepHidden(step_name); |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual void OnHelpButtonClicked() OVERRIDE { | 48 virtual void OnHelpButtonClicked() override { |
| 49 controller()->OnHelpButtonClicked(); | 49 controller()->OnHelpButtonClicked(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 virtual void OnActorFinalized() OVERRIDE { | 52 virtual void OnActorFinalized() override { |
| 53 finalized_ = true; | 53 finalized_ = true; |
| 54 if (!on_finalized_callback_.is_null()) | 54 if (!on_finalized_callback_.is_null()) |
| 55 on_finalized_callback_.Run(); | 55 on_finalized_callback_.Run(); |
| 56 controller()->OnActorFinalized(); | 56 controller()->OnActorFinalized(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void OnActorDestroyed() OVERRIDE { | 59 virtual void OnActorDestroyed() override { |
| 60 controller()->OnActorDestroyed(); | 60 controller()->OnActorDestroyed(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void LaunchTutorial() { | 63 void LaunchTutorial() { |
| 64 chromeos::first_run::LaunchTutorial(); | 64 chromeos::first_run::LaunchTutorial(); |
| 65 EXPECT_TRUE(controller() != NULL); | 65 EXPECT_TRUE(controller() != NULL); |
| 66 // Replacing delegate to observe all messages coming from WebUI to | 66 // Replacing delegate to observe all messages coming from WebUI to |
| 67 // controller. | 67 // controller. |
| 68 controller()->actor_->set_delegate(this); | 68 controller()->actor_->set_delegate(this); |
| 69 initialized_ = controller()->actor_->IsInitialized(); | 69 initialized_ = controller()->actor_->IsInitialized(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 WaitForFinalization(); | 138 WaitForFinalization(); |
| 139 content::RunAllPendingInMessageLoop(); | 139 content::RunAllPendingInMessageLoop(); |
| 140 EXPECT_EQ(controller(), (void*)NULL); | 140 EXPECT_EQ(controller(), (void*)NULL); |
| 141 // shell_helper() is destructed already, thats why we call Shell directly. | 141 // shell_helper() is destructed already, thats why we call Shell directly. |
| 142 EXPECT_FALSE(ash::Shell::GetInstance()->GetPrimarySystemTray()-> | 142 EXPECT_FALSE(ash::Shell::GetInstance()->GetPrimarySystemTray()-> |
| 143 HasSystemBubble()); | 143 HasSystemBubble()); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace chromeos | 146 } // namespace chromeos |
| 147 | 147 |
| OLD | NEW |