| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ |
| 6 #define CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ | 6 #define CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "base/gtest_prod_util.h" |
| 12 #include "base/time.h" | 13 #include "base/time.h" |
| 13 #include "chrome/browser/dom_ui/html_dialog_ui.h" | 14 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
| 14 #include "chrome/browser/sync/profile_sync_service.h" | 15 #include "chrome/browser/sync/profile_sync_service.h" |
| 15 #include "chrome/browser/sync/sync_setup_wizard.h" | 16 #include "chrome/browser/sync/sync_setup_wizard.h" |
| 16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 17 #include "chrome/browser/views/options/customize_sync_window_view.h" | 18 #include "chrome/browser/views/options/customize_sync_window_view.h" |
| 18 #elif defined(OS_LINUX) | 19 #elif defined(OS_LINUX) |
| 19 #include "chrome/browser/gtk/options/customize_sync_window_gtk.h" | 20 #include "chrome/browser/gtk/options/customize_sync_window_gtk.h" |
| 20 #elif defined(OS_MACOSX) | 21 #elif defined(OS_MACOSX) |
| 21 #include "chrome/browser/cocoa/sync_customize_controller_cppsafe.h" | 22 #include "chrome/browser/cocoa/sync_customize_controller_cppsafe.h" |
| 22 #endif | 23 #endif |
| 23 #include "gfx/native_widget_types.h" | 24 #include "gfx/native_widget_types.h" |
| 24 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 25 #include "testing/gtest/include/gtest/gtest_prod.h" | |
| 26 | 26 |
| 27 class FlowHandler; | 27 class FlowHandler; |
| 28 class SyncSetupFlowContainer; | 28 class SyncSetupFlowContainer; |
| 29 | 29 |
| 30 // The state machine used by SyncSetupWizard, exposed in its own header | 30 // The state machine used by SyncSetupWizard, exposed in its own header |
| 31 // to facilitate testing of SyncSetupWizard. This class is used to open and | 31 // to facilitate testing of SyncSetupWizard. This class is used to open and |
| 32 // run the html dialog and deletes itself when the dialog closes. | 32 // run the html dialog and deletes itself when the dialog closes. |
| 33 class SyncSetupFlow : public HtmlDialogUIDelegate { | 33 class SyncSetupFlow : public HtmlDialogUIDelegate { |
| 34 public: | 34 public: |
| 35 virtual ~SyncSetupFlow(); | 35 virtual ~SyncSetupFlow(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 | 123 |
| 124 void OnUserSubmittedAuth(const std::string& username, | 124 void OnUserSubmittedAuth(const std::string& username, |
| 125 const std::string& password, | 125 const std::string& password, |
| 126 const std::string& captcha) { | 126 const std::string& captcha) { |
| 127 service_->OnUserSubmittedAuth(username, password, captcha); | 127 service_->OnUserSubmittedAuth(username, password, captcha); |
| 128 } | 128 } |
| 129 | 129 |
| 130 private: | 130 private: |
| 131 FRIEND_TEST(SyncSetupWizardTest, InitialStepLogin); | 131 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepLogin); |
| 132 FRIEND_TEST(SyncSetupWizardTest, InitialStepMergeAndSync); | 132 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepMergeAndSync); |
| 133 FRIEND_TEST(SyncSetupWizardTest, DialogCancelled); | 133 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DialogCancelled); |
| 134 FRIEND_TEST(SyncSetupWizardTest, InvalidTransitions); | 134 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InvalidTransitions); |
| 135 FRIEND_TEST(SyncSetupWizardTest, FullSuccessfulRunSetsPref); | 135 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, FullSuccessfulRunSetsPref); |
| 136 FRIEND_TEST(SyncSetupWizardTest, DiscreteRun); | 136 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DiscreteRun); |
| 137 | 137 |
| 138 // Use static Run method to get an instance. | 138 // Use static Run method to get an instance. |
| 139 SyncSetupFlow(SyncSetupWizard::State start_state, | 139 SyncSetupFlow(SyncSetupWizard::State start_state, |
| 140 SyncSetupWizard::State end_state, | 140 SyncSetupWizard::State end_state, |
| 141 const std::string& args, SyncSetupFlowContainer* container, | 141 const std::string& args, SyncSetupFlowContainer* container, |
| 142 ProfileSyncService* service); | 142 ProfileSyncService* service); |
| 143 | 143 |
| 144 // Returns true if |this| should transition its state machine to |state| | 144 // Returns true if |this| should transition its state machine to |state| |
| 145 // based on |current_state_|, or false if that would be nonsense or is | 145 // based on |current_state_|, or false if that would be nonsense or is |
| 146 // a no-op. | 146 // a no-op. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 218 } |
| 219 | 219 |
| 220 private: | 220 private: |
| 221 void ExecuteJavascriptInIFrame(const std::wstring& iframe_xpath, | 221 void ExecuteJavascriptInIFrame(const std::wstring& iframe_xpath, |
| 222 const std::wstring& js); | 222 const std::wstring& js); |
| 223 SyncSetupFlow* flow_; | 223 SyncSetupFlow* flow_; |
| 224 DISALLOW_COPY_AND_ASSIGN(FlowHandler); | 224 DISALLOW_COPY_AND_ASSIGN(FlowHandler); |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 #endif // CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ | 227 #endif // CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ |
| OLD | NEW |