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 | |
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
21 files changed, 159 insertions, 104 deletions
diff --git a/app/app.gyp b/app/app.gyp index c7ef0c7..329eb04 100644 --- a/app/app.gyp +++ b/app/app.gyp @@ -92,14 +92,16 @@ 'gfx/codec/jpeg_codec.h', 'gfx/codec/png_codec.cc', 'gfx/codec/png_codec.h', + 'gfx/color_utils.cc', + 'gfx/color_utils.h', + 'gfx/favicon_size.h', 'gfx/font.h', 'gfx/font_gtk.cc', 'gfx/font_mac.mm', 'gfx/font_skia.cc', + 'gfx/font_util.h', + 'gfx/font_util.cc', 'gfx/font_win.cc', - 'gfx/color_utils.cc', - 'gfx/color_utils.h', - 'gfx/favicon_size.h', 'gfx/gdi_util.cc', 'gfx/gdi_util.h', 'gfx/gtk_util.cc', diff --git a/app/gfx/font_util.cc b/app/gfx/font_util.cc new file mode 100644 index 0000000..278677c --- /dev/null +++ b/app/gfx/font_util.cc @@ -0,0 +1,39 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/gfx/font_util.h" + +#include "app/gfx/font.h" +#include "app/l10n_util.h" +#include "base/logging.h" + +namespace gfx { + +int GetLocalizedContentsWidthForFont(int col_resource_id, + const gfx::Font& font) { + double chars = 0; + StringToDouble(WideToUTF8(l10n_util::GetString(col_resource_id)), &chars); + int width = font.GetExpectedTextWidth(static_cast<int>(chars)); + DCHECK(width > 0); + return width; +} + +int GetLocalizedContentsHeightForFont(int row_resource_id, + const gfx::Font& font) { + double lines = 0; + StringToDouble(WideToUTF8(l10n_util::GetString(row_resource_id)), &lines); + int height = static_cast<int>(font.height() * lines); + DCHECK(height > 0); + return height; +} + +gfx::Size GetLocalizedContentsSizeForFont(int col_resource_id, + int row_resource_id, + const gfx::Font& font) { + return gfx::Size(GetLocalizedContentsWidthForFont(col_resource_id, font), + GetLocalizedContentsHeightForFont(row_resource_id, font)); +} + +} // namespace gfx + diff --git a/app/gfx/font_util.h b/app/gfx/font_util.h new file mode 100644 index 0000000..36bc693 --- /dev/null +++ b/app/gfx/font_util.h @@ -0,0 +1,29 @@ +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef APP_GFX_FONT_UTIL_H_ +#define APP_GFX_FONT_UTIL_H_ + +#include "base/gfx/size.h" + +namespace gfx { + +class Font; + +// Returns the preferred size of the contents view of a window based on +// its localized size data and the given font. The width in cols is held in a +// localized string resource identified by |col_resource_id|, the height in the +// same fashion. +int GetLocalizedContentsWidthForFont(int col_resource_id, + const gfx::Font& font); +int GetLocalizedContentsHeightForFont(int row_resource_id, + const gfx::Font& font); +gfx::Size GetLocalizedContentsSizeForFont(int col_resource_id, + int row_resource_id, + const gfx::Font& font); + +} // namespace gfx + +#endif // APP_GFX_FONT_UTIL_H_ + 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); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 1222730..8c47be4 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -155,7 +155,7 @@ }], # branding ], # conditions }], # OS=="mac" - ['OS=="win"', { + ['OS=="win" or OS=="mac"', { # Whether or not browser sync code is built in. 'chrome_personalization%': 1, }, { @@ -205,7 +205,7 @@ ['OS=="linux" and toolkit_views==1', {'sources/': [ ['include', '_views\\.cc$'], ]}], - ['OS=="win" and chrome_personalization==1', { + ['(OS=="win" or OS=="mac") and chrome_personalization==1', { 'defines': ['CHROME_PERSONALIZATION=1'], }], # chrome_personalization==1 ], @@ -2045,6 +2045,10 @@ 'browser/sync/glue/sync_backend_host.h', 'browser/sync/profile_sync_service.cc', 'browser/sync/profile_sync_service.h', + 'browser/sync/sync_setup_flow.cc', + 'browser/sync/sync_setup_flow.h', + 'browser/sync/sync_setup_wizard.cc', + 'browser/sync/sync_setup_wizard.h', 'browser/sync/sync_status_ui_helper.cc', 'browser/sync/sync_status_ui_helper.h', 'browser/tab_contents/constrained_window.h', @@ -2294,10 +2298,6 @@ 'browser/views/star_toggle.h', 'browser/views/status_bubble_views.cc', 'browser/views/status_bubble_views.h', - 'browser/views/sync/sync_setup_flow.cc', - 'browser/views/sync/sync_setup_flow.h', - 'browser/views/sync/sync_setup_wizard.cc', - 'browser/views/sync/sync_setup_wizard.h', 'browser/views/tab_icon_view.cc', 'browser/views/tab_icon_view.h', 'browser/views/tab_contents/tab_contents_container.cc', @@ -3922,6 +3922,7 @@ 'test/perf/mem_usage_mac.cc', 'test/perf/mem_usage_win.cc', 'test/perf/mem_usage.h', + 'test/test_browser_window.h', 'test/testing_profile.cc', 'test/testing_profile.h', 'test/ui_test_utils.cc', @@ -4552,6 +4553,7 @@ 'browser/sync/glue/bookmark_model_worker_unittest.cc', 'browser/sync/glue/http_bridge_unittest.cc', 'browser/sync/profile_sync_service_unittest.cc', + 'browser/sync/sync_setup_wizard_unittest.cc', 'browser/tab_contents/navigation_controller_unittest.cc', 'browser/tab_contents/navigation_entry_unittest.cc', 'browser/tab_contents/render_view_host_manager_unittest.cc', @@ -4563,7 +4565,6 @@ 'browser/utility_process_host_unittest.cc', 'browser/views/bookmark_context_menu_test.cc', 'browser/views/bookmark_editor_view_unittest.cc', - 'browser/views/sync/sync_setup_wizard_unittest.cc', 'browser/visitedlink_unittest.cc', 'browser/webdata/web_database_unittest.cc', 'browser/window_sizer_unittest.cc', @@ -4634,6 +4635,8 @@ 'browser/renderer_host/gtk_key_bindings_handler_unittest.cc', ], 'sources!': [ + # TODO(akalin): Figure out why this unittest fails on linux. + 'browser/browser_commands_unittest.cc', 'browser/views/bookmark_context_menu_test.cc', 'browser/gtk/options/cookies_view_unittest.cc', # Compact Language Detection (cld) is not supported in linux yet. @@ -4756,8 +4759,6 @@ 'browser/bookmarks/bookmark_drag_data_unittest.cc', 'browser/bookmarks/bookmark_folder_tree_model_unittest.cc', 'browser/bookmarks/bookmark_table_model_unittest.cc', - # Need to port browser_with_test_window_test.* first - 'browser/browser_commands_unittest.cc', 'browser/browser_unittest.cc', 'browser/extensions/extension_process_manager_unittest.cc', 'browser/importer/importer_unittest.cc', @@ -4769,11 +4770,8 @@ 'browser/views/bookmark_editor_view_unittest.cc', 'browser/views/find_bar_host_unittest.cc', 'browser/views/keyword_editor_view_unittest.cc', - 'browser/views/sync/sync_setup_wizard_unittest.cc', 'common/chrome_plugin_unittest.cc', 'common/net/url_util_unittest.cc', - 'test/browser_with_test_window_test.cc', - 'test/browser_with_test_window_test.h', ], }], ['chrome_personalization==1', { @@ -6711,6 +6709,10 @@ '-lsecur32.lib', ], }, + }, { # else: OS != "win" + 'sources!': [ + 'browser/sync/util/data_encryption_unittest.cc', + ], }], ['OS=="linux"', { 'defines': [ diff --git a/chrome/test/browser_with_test_window_test.cc b/chrome/test/browser_with_test_window_test.cc index 3e3fb93..8dede7c 100644 --- a/chrome/test/browser_with_test_window_test.cc +++ b/chrome/test/browser_with_test_window_test.cc @@ -12,7 +12,9 @@ BrowserWithTestWindowTest::BrowserWithTestWindowTest() : rph_factory_(), rvh_factory_(&rph_factory_) { +#if defined(OS_WIN) OleInitialize(NULL); +#endif } void BrowserWithTestWindowTest::SetUp() { @@ -38,7 +40,9 @@ BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); MessageLoop::current()->Run(); +#if defined(OS_WIN) OleUninitialize(); +#endif } TestRenderViewHost* BrowserWithTestWindowTest::TestRenderViewHostForTab( diff --git a/chrome/test/sync/engine/mock_server_connection.cc b/chrome/test/sync/engine/mock_server_connection.cc index 372d408..b2af891 100644 --- a/chrome/test/sync/engine/mock_server_connection.cc +++ b/chrome/test/sync/engine/mock_server_connection.cc @@ -43,9 +43,9 @@ MockConnectionManager::MockConnectionManager(DirectoryManager* dirmgr, directory_name_(name), mid_commit_callback_function_(NULL), mid_commit_observer_(NULL), - client_command_(NULL), throttling_(false), fail_non_periodic_get_updates_(false), + client_command_(NULL), next_position_in_parent_(2) { server_reachable_ = true; }; @@ -405,4 +405,5 @@ void MockConnectionManager::ThrottleNextRequest( throttling_ = true; if (visitor) visitor->VisitAtomically(); -}
\ No newline at end of file +} + diff --git a/chrome/test/sync/engine/test_directory_setter_upper.cc b/chrome/test/sync/engine/test_directory_setter_upper.cc index 2685795..9e910f0 100644 --- a/chrome/test/sync/engine/test_directory_setter_upper.cc +++ b/chrome/test/sync/engine/test_directory_setter_upper.cc @@ -85,12 +85,6 @@ void ManuallyOpenedTestDirectorySetterUpper::TearDown() { TestDirectorySetterUpper::TearDown(); } } - -static PathString UTF8ToPathStringQuick(const std::string &str) { - PathString ret; - CHECK(browser_sync::UTF8ToPathString(str.data(), str.size(), &ret)); - return ret; -} TriggeredOpenTestDirectorySetterUpper::TriggeredOpenTestDirectorySetterUpper( const std::string& name) diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h index 8aa657d..d785415 100644 --- a/chrome/test/test_browser_window.h +++ b/chrome/test/test_browser_window.h @@ -7,18 +7,14 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_window.h" -#include "chrome/browser/views/tabs/tab_strip.h" #include "chrome/test/test_location_bar.h" // An implementation of BrowserWindow used for testing. TestBrowserWindow only -// contains a valid TabStrip, all other getters return NULL. +// contains a valid LocationBar, all other getters return NULL. // See BrowserWithTestWindowTest for an example of using this class. class TestBrowserWindow : public BrowserWindow { public: - explicit TestBrowserWindow(Browser* browser) - : tab_strip_(browser->tabstrip_model()) { - tab_strip_.InitTabStripButtons(); - } + explicit TestBrowserWindow(Browser* browser) {} virtual ~TestBrowserWindow() {} virtual void Init() {} @@ -91,8 +87,6 @@ class TestBrowserWindow : public BrowserWindow { virtual void DestroyBrowser() {} private: - TabStrip tab_strip_; - TestLocationBar location_bar_; DISALLOW_COPY_AND_ASSIGN(TestBrowserWindow); diff --git a/views/window/window.cc b/views/window/window.cc index 9f69172..18b4d51 100644 --- a/views/window/window.cc +++ b/views/window/window.cc @@ -5,7 +5,7 @@ #include "views/window/window.h" #include "app/gfx/font.h" -#include "app/l10n_util.h" +#include "app/gfx/font_util.h" #include "app/resource_bundle.h" #include "base/gfx/size.h" #include "base/string_util.h" @@ -14,44 +14,17 @@ namespace views { // static -int Window::GetLocalizedContentsWidthForFont(int col_resource_id, - const gfx::Font& font) { - double chars = 0; - StringToDouble(WideToUTF8(l10n_util::GetString(col_resource_id)), &chars); - int width = font.GetExpectedTextWidth(static_cast<int>(chars)); - DCHECK(width > 0); - return width; -} - -// static int Window::GetLocalizedContentsWidth(int col_resource_id) { - return GetLocalizedContentsWidthForFont(col_resource_id, + return gfx::GetLocalizedContentsWidthForFont(col_resource_id, ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); } // static -int Window::GetLocalizedContentsHeightForFont(int row_resource_id, - const gfx::Font& font) { - double lines = 0; - StringToDouble(WideToUTF8(l10n_util::GetString(row_resource_id)), &lines); - int height = static_cast<int>(font.height() * lines); - DCHECK(height > 0); - return height; -} - -// static int Window::GetLocalizedContentsHeight(int row_resource_id) { - return GetLocalizedContentsHeightForFont(row_resource_id, + return gfx::GetLocalizedContentsHeightForFont(row_resource_id, ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); } -gfx::Size Window::GetLocalizedContentsSizeForFont(int col_resource_id, - int row_resource_id, - const gfx::Font& font) { - return gfx::Size(GetLocalizedContentsWidthForFont(col_resource_id, font), - GetLocalizedContentsHeightForFont(row_resource_id, font)); -} - // static gfx::Size Window::GetLocalizedContentsSize(int col_resource_id, int row_resource_id) { diff --git a/views/window/window.h b/views/window/window.h index f2f9e34..becb8d0 100644 --- a/views/window/window.h +++ b/views/window/window.h @@ -43,16 +43,6 @@ class Window { static gfx::Size GetLocalizedContentsSize(int col_resource_id, int row_resource_id); - // These versions of GetLocalizedContents allow a font to be specified - // other than the default UI font. - static int GetLocalizedContentsWidthForFont(int col_resource_id, - const gfx::Font& font); - static int GetLocalizedContentsHeightForFont(int row_resource_id, - const gfx::Font& font); - static gfx::Size GetLocalizedContentsSizeForFont(int col_resource_id, - int row_resource_id, - const gfx::Font& font); - // Closes all windows that aren't identified as "app windows" via // IsAppWindow. Called during application shutdown when the last "app window" // is closed. |