diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-16 05:52:33 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-16 05:52:33 +0000 |
commit | 3429e58d3540e6973db5a7661cbbd2dd1997ac61 (patch) | |
tree | f2cccb493a33f25eaf504d98e6936fb05a43c424 /chrome/browser | |
parent | 36cd42f16e38b8ed0133d71f503848b4577d402f (diff) | |
download | chromium_src-3429e58d3540e6973db5a7661cbbd2dd1997ac61.zip chromium_src-3429e58d3540e6973db5a7661cbbd2dd1997ac61.tar.gz chromium_src-3429e58d3540e6973db5a7661cbbd2dd1997ac61.tar.bz2 |
Made sync code build and pass unit tests on OS X.
Major changes:
- Moved sync_setup_{flow,wizard} to sync directory.
- Made browser_with_test_window_test compile on non-Windows platform.
- Moved localized contents font util functions to app/.
BUG=23073
TEST=trybot
Review URL: http://codereview.chromium.org/279004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29253 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_window.h | 2 | ||||
-rw-r--r-- | chrome/browser/sync/engine/syncer.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.h | 2 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_flow.cc (renamed from chrome/browser/views/sync/sync_setup_flow.cc) | 13 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_flow.h (renamed from chrome/browser/views/sync/sync_setup_flow.h) | 8 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.cc (renamed from chrome/browser/views/sync/sync_setup_wizard.cc) | 4 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.h (renamed from chrome/browser/views/sync/sync_setup_wizard.h) | 19 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard_unittest.cc (renamed from chrome/browser/views/sync/sync_setup_wizard_unittest.cc) | 4 | ||||
-rw-r--r-- | chrome/browser/sync/util/character_set_converters.h | 15 | ||||
-rw-r--r-- | chrome/browser/sync/util/user_settings_unittest.cc | 12 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_view_mac.mm | 12 |
11 files changed, 60 insertions, 33 deletions
diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h index a83fbbd..f417166 100644 --- a/chrome/browser/browser_window.h +++ b/chrome/browser/browser_window.h @@ -31,7 +31,7 @@ class Rect; // BrowserWindow interface // An interface implemented by the "view" of the Browser window. // -// NOTE: All getters except GetTabStrip() may return NULL. +// NOTE: All getters may return NULL. class BrowserWindow { public: // Show the window, or activates it if it's already visible. diff --git a/chrome/browser/sync/engine/syncer.cc b/chrome/browser/sync/engine/syncer.cc index 9274edf..de8b1b2 100644 --- a/chrome/browser/sync/engine/syncer.cc +++ b/chrome/browser/sync/engine/syncer.cc @@ -118,7 +118,7 @@ void Syncer::SyncShare(SyncerSession* session, // Reset silenced_until_, it is the callers responsibility to honor throttles. silenced_until_ = session->silenced_until(); - SyncerStep next_step; + SyncerStep next_step = current_step; while (!ExitRequested()) { switch (current_step) { case SYNCER_BEGIN: diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index fab7ea5..9eedbef 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -20,7 +20,7 @@ #include "chrome/browser/sync/glue/change_processor.h" #include "chrome/browser/sync/glue/model_associator.h" #include "chrome/browser/sync/glue/sync_backend_host.h" -#include "chrome/browser/views/sync/sync_setup_wizard.h" +#include "chrome/browser/sync/sync_setup_wizard.h" #include "chrome/common/notification_registrar.h" #include "googleurl/src/gurl.h" diff --git a/chrome/browser/views/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index 01a5728..2784572 100644 --- a/chrome/browser/views/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -4,13 +4,15 @@ #ifdef CHROME_PERSONALIZATION -#include "chrome/browser/views/sync/sync_setup_flow.h" +#include "chrome/browser/sync/sync_setup_flow.h" #include "app/gfx/font.h" +#include "app/gfx/font_util.h" #include "base/histogram.h" #include "base/json_reader.h" #include "base/json_writer.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" @@ -20,7 +22,6 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/pref_names.h" #include "grit/locale_settings.h" -#include "views/window/window.h" // XPath expression for finding specific iframes. static const wchar_t* kLoginIFrameXPath = L"//iframe[@id='login']"; @@ -156,7 +157,7 @@ void SyncSetupFlow::GetDialogSize(gfx::Size* size) const { prefs->GetString(prefs::kWebKitSansSerifFontFamily), prefs->GetInteger(prefs::kWebKitDefaultFontSize)); - gfx::Size s = views::Window::GetLocalizedContentsSizeForFont( + gfx::Size s = gfx::GetLocalizedContentsSizeForFont( IDS_SYNC_SETUP_WIZARD_WIDTH_CHARS, IDS_SYNC_SETUP_WIZARD_HEIGHT_LINES, approximate_web_font); @@ -264,10 +265,12 @@ void SyncSetupFlow::Advance(SyncSetupWizard::State advance_state) { flow_handler_->ShowMergeAndSyncError(); break; case SyncSetupWizard::DONE_FIRST_TIME: - flow_handler_->ShowFirstTimeDone(service_->GetAuthenticatedUsername()); + flow_handler_->ShowFirstTimeDone( + UTF16ToWide(service_->GetAuthenticatedUsername())); break; case SyncSetupWizard::DONE: - flow_handler_->ShowSetupDone(service_->GetAuthenticatedUsername()); + flow_handler_->ShowSetupDone( + UTF16ToWide(service_->GetAuthenticatedUsername())); break; default: NOTREACHED() << "Invalid advance state: " << advance_state; diff --git a/chrome/browser/views/sync/sync_setup_flow.h b/chrome/browser/sync/sync_setup_flow.h index 4bc7d60..32e3db1 100644 --- a/chrome/browser/views/sync/sync_setup_flow.h +++ b/chrome/browser/sync/sync_setup_flow.h @@ -4,8 +4,8 @@ #ifdef CHROME_PERSONALIZATION -#ifndef CHROME_BROWSER_VIEWS_SYNC_SYNC_SETUP_FLOW_H_ -#define CHROME_BROWSER_VIEWS_SYNC_SYNC_SETUP_FLOW_H_ +#ifndef CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ +#define CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ #include <string> #include <vector> @@ -14,7 +14,7 @@ #include "base/time.h" #include "chrome/browser/dom_ui/html_dialog_ui.h" #include "chrome/browser/sync/profile_sync_service.h" -#include "chrome/browser/views/sync/sync_setup_wizard.h" +#include "chrome/browser/sync/sync_setup_wizard.h" #include "grit/generated_resources.h" #include "testing/gtest/include/gtest/gtest_prod.h" @@ -185,5 +185,5 @@ class FlowHandler : public DOMMessageHandler { DISALLOW_COPY_AND_ASSIGN(FlowHandler); }; -#endif // CHROME_BROWSER_VIEWS_SYNC_SYNC_SETUP_FLOW_H_ +#endif // CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ #endif // CHROME_PERSONALIZATION diff --git a/chrome/browser/views/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc index 31afcea..7d00ab9 100644 --- a/chrome/browser/views/sync/sync_setup_wizard.cc +++ b/chrome/browser/sync/sync_setup_wizard.cc @@ -4,7 +4,7 @@ #ifdef CHROME_PERSONALIZATION -#include "chrome/browser/views/sync/sync_setup_wizard.h" +#include "chrome/browser/sync/sync_setup_wizard.h" #include "app/resource_bundle.h" #include "base/message_loop.h" @@ -13,7 +13,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" #include "chrome/browser/sync/profile_sync_service.h" -#include "chrome/browser/views/sync/sync_setup_flow.h" +#include "chrome/browser/sync/sync_setup_flow.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/url_constants.h" #include "grit/app_resources.h" diff --git a/chrome/browser/views/sync/sync_setup_wizard.h b/chrome/browser/sync/sync_setup_wizard.h index 1d36f61..d8a0d95 100644 --- a/chrome/browser/views/sync/sync_setup_wizard.h +++ b/chrome/browser/sync/sync_setup_wizard.h @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_VIEWS_SYNC_SYNC_SETUP_WIZARD_H_ -#define CHROME_BROWSER_VIEWS_SYNC_SYNC_SETUP_WIZARD_H_ +#ifndef CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_ +#define CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_ #include "base/basictypes.h" -#if defined(OS_WIN) -class SyncSetupFlowContainer; -#elif defined(OS_LINUX) +#if defined(OS_LINUX) typedef struct _GtkWidget GtkWidget; typedef struct _GtkWindow GtkWindow; +#else +class SyncSetupFlowContainer; #endif class ProfileSyncService; @@ -69,13 +69,14 @@ class SyncSetupWizard { ProfileSyncService* service_; -#if defined(OS_WIN) - SyncSetupFlowContainer* flow_container_; -#elif defined(OS_LINUX) +#if defined(OS_LINUX) bool visible_; +#else + SyncSetupFlowContainer* flow_container_; #endif DISALLOW_COPY_AND_ASSIGN(SyncSetupWizard); }; -#endif // CHROME_BROWSER_VIEWS_SYNC_SYNC_SETUP_WIZARD_H_ +#endif // CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_ + diff --git a/chrome/browser/views/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc index fec7ef3..3a04746 100644 --- a/chrome/browser/views/sync/sync_setup_wizard_unittest.cc +++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc @@ -11,8 +11,8 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/sync/profile_sync_service.h" -#include "chrome/browser/views/sync/sync_setup_flow.h" -#include "chrome/browser/views/sync/sync_setup_wizard.h" +#include "chrome/browser/sync/sync_setup_flow.h" +#include "chrome/browser/sync/sync_setup_wizard.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/test/browser_with_test_window_test.h" diff --git a/chrome/browser/sync/util/character_set_converters.h b/chrome/browser/sync/util/character_set_converters.h index 1db32c7..6a833ee 100644 --- a/chrome/browser/sync/util/character_set_converters.h +++ b/chrome/browser/sync/util/character_set_converters.h @@ -136,6 +136,21 @@ inline void AppendPathStringToUTF8(const PathString& wide, return AppendPathStringToUTF8(wide.data(), wide.length(), output_string); } +// Versions of UTF8ToPathString/PathStringToUTF8 that return the converted +// string directly. Any errors encountered will CHECK(). These functions are +// intended to be used only for testing. + +inline PathString UTF8ToPathStringQuick(const std::string &utf8) { + PathString wide; + CHECK(UTF8ToPathString(utf8.data(), utf8.size(), &wide)); + return wide; +} + +inline std::string PathStringToUTF8Quick(const PathString& wide) { + std::string utf8; + PathStringToUTF8(wide.data(), wide.size(), &utf8); + return utf8; +} inline bool Append(const PathChar* wide, int size, std::string* output_string) { diff --git a/chrome/browser/sync/util/user_settings_unittest.cc b/chrome/browser/sync/util/user_settings_unittest.cc index 952c86b..02f3fd8 100644 --- a/chrome/browser/sync/util/user_settings_unittest.cc +++ b/chrome/browser/sync/util/user_settings_unittest.cc @@ -2,9 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE entry. +#include <string> + #include "base/file_util.h" #include "base/test/test_file_util.h" #include "chrome/browser/sync/syncable/directory_manager.h" +#include "chrome/browser/sync/util/character_set_converters.h" #include "chrome/browser/sync/util/user_settings.h" #include "chrome/browser/sync/util/query_helpers.h" #include "testing/gtest/include/gtest/gtest.h" @@ -40,15 +43,10 @@ class UserSettingsTest : public testing::Test { ExecOrDie(primer_handle, "CREATE TABLE shares" " (email, share_name, file_name," " PRIMARY KEY(email, share_name) ON CONFLICT REPLACE)"); -#if OS_WIN - // Populate a share. - ExecOrDie(primer_handle, "INSERT INTO shares values ( ?, ?, ?)", - "foo@foo.com", "foo@foo.com", WideToUTF8(kOldStyleSyncDataDB)); -#elif OS_LINUX // Populate a share. ExecOrDie(primer_handle, "INSERT INTO shares values ( ?, ?, ?)", - "foo@foo.com", "foo@foo.com", kOldStyleSyncDataDB); -#endif + "foo@foo.com", "foo@foo.com", + browser_sync::PathStringToUTF8Quick(kOldStyleSyncDataDB)); sqlite3_close(primer_handle); } diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm index 21b4970..c966ee8 100644 --- a/chrome/browser/tab_contents/tab_contents_view_mac.mm +++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm @@ -16,6 +16,7 @@ #include "chrome/browser/cocoa/sad_tab_view.h" #import "chrome/browser/cocoa/web_drag_source.h" #import "chrome/browser/cocoa/web_drop_target.h" +#include "chrome/browser/renderer_host/render_view_host_factory.h" #include "chrome/browser/renderer_host/render_widget_host.h" #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" @@ -71,7 +72,16 @@ void TabContentsViewMac::CreateView(const gfx::Size& initial_size) { RenderWidgetHostView* TabContentsViewMac::CreateViewForWidget( RenderWidgetHost* render_widget_host) { - DCHECK(!render_widget_host->view()); + if (render_widget_host->view()) { + // During testing, the view will already be set up in most cases to the + // test view, so we don't want to clobber it with a real one. To verify that + // this actually is happening (and somebody isn't accidentally creating the + // view twice), we check for the RVH Factory, which will be set when we're + // making special ones (which go along with the special views). + DCHECK(RenderViewHostFactory::has_factory()); + return render_widget_host->view(); + } + RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(render_widget_host); |