diff --git a/tests/cefclient/bytes_write_handler.cc b/tests/cefclient/bytes_write_handler.cc index 7569417a5..778fa8747 100644 --- a/tests/cefclient/bytes_write_handler.cc +++ b/tests/cefclient/bytes_write_handler.cc @@ -9,6 +9,8 @@ #include "include/wrapper/cef_helpers.h" +namespace client { + BytesWriteHandler::BytesWriteHandler(size_t grow) : grow_(grow), datasize_(grow), @@ -92,3 +94,5 @@ size_t BytesWriteHandler::Grow(size_t size) { return rv; } + +} // namespace client diff --git a/tests/cefclient/bytes_write_handler.h b/tests/cefclient/bytes_write_handler.h index 9077cf33f..6d9f141f9 100644 --- a/tests/cefclient/bytes_write_handler.h +++ b/tests/cefclient/bytes_write_handler.h @@ -9,6 +9,8 @@ #include "include/base/cef_lock.h" #include "include/cef_stream.h" +namespace client { + class BytesWriteHandler : public CefWriteHandler { public: explicit BytesWriteHandler(size_t grow); @@ -36,4 +38,6 @@ class BytesWriteHandler : public CefWriteHandler { IMPLEMENT_REFCOUNTING(BytesWriteHandler); }; +} // namespace client + #endif // CEF_TESTS_CEFCLIENT_BYTES_WRITE_HANDLER_H_ diff --git a/tests/cefclient/cefclient_gtk.cc b/tests/cefclient/cefclient_gtk.cc index 92358a735..4ff14f01f 100644 --- a/tests/cefclient/cefclient_gtk.cc +++ b/tests/cefclient/cefclient_gtk.cc @@ -30,18 +30,21 @@ #include "cefclient/resource.h" #include "cefclient/test_runner.h" +namespace client { +namespace { + // The global ClientHandler reference. CefRefPtr g_handler; -namespace { - // Height of the buttons at the top of the GTK window. int g_toolbar_height = 0; // Height of the integrated menu bar (if any) at the top of the GTK window. int g_menubar_height = 0; -class MainBrowserProvider : public client::OSRBrowserProvider { + +// Used by off-screen rendering to find the associated CefBrowser. +class MainBrowserProvider : public OSRBrowserProvider { virtual CefRefPtr GetBrowser() { if (g_handler.get()) return g_handler->GetBrowser(); @@ -50,6 +53,7 @@ class MainBrowserProvider : public client::OSRBrowserProvider { } } g_main_browser_provider; + int XErrorHandlerImpl(Display *display, XErrorEvent *event) { LOG(WARNING) << "X error received: " @@ -89,7 +93,7 @@ gboolean delete_event(GtkWidget* widget, GdkEvent* event, } void TerminationSignalHandler(int signatl) { - client::MainMessageLoop::Get()->Quit(); + MainMessageLoop::Get()->Quit(); } void VboxSizeAllocated(GtkWidget* widget, @@ -225,10 +229,8 @@ gboolean WindowConfigure(GtkWindow* window, // Callback for Tests menu items. gboolean MenuItemActivated(GtkWidget* widget, gpointer data) { - if (g_handler.get() && g_handler->GetBrowserId()) { - client::test_runner::RunTest(g_handler->GetBrowser(), - GPOINTER_TO_INT(data)); - } + if (g_handler.get() && g_handler->GetBrowserId()) + test_runner::RunTest(g_handler->GetBrowser(), GPOINTER_TO_INT(data)); return FALSE; // Don't stop this message. } @@ -317,9 +319,7 @@ GtkWidget* CreateMenuBar() { return menu_bar; } -} // namespace - -int main(int argc, char* argv[]) { +int RunMain(int argc, char* argv[]) { // Create a copy of |argv| on Linux because Chromium mangles the value // internally (see issue #620). CefScopedArgArray scoped_arg_array(argc, argv); @@ -334,8 +334,7 @@ int main(int argc, char* argv[]) { return exit_code; // Create the main context object. - scoped_ptr context( - new client::MainContextImpl(argc, argv)); + scoped_ptr context(new MainContextImpl(argc, argv)); CefSettings settings; @@ -348,8 +347,7 @@ int main(int argc, char* argv[]) { XSetIOErrorHandler(XIOErrorHandlerImpl); // Create the main message loop object. - scoped_ptr message_loop( - new client::MainMessageLoopStd); + scoped_ptr message_loop(new MainMessageLoopStd); // Initialize CEF. CefInitialize(main_args, settings, app.get(), NULL); @@ -362,7 +360,7 @@ int main(int argc, char* argv[]) { gtk_gl_init(&argc, &argv_copy); // Register scheme handlers. - client::test_runner::RegisterSchemeHandlers(); + test_runner::RegisterSchemeHandlers(); GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window), 800, 600); @@ -443,16 +441,16 @@ int main(int argc, char* argv[]) { CefRefPtr command_line = CefCommandLine::GetGlobalCommandLine(); - if (command_line->HasSwitch(cefclient::kOffScreenRenderingEnabled)) { + if (command_line->HasSwitch(switches::kOffScreenRenderingEnabled)) { const bool transparent = - command_line->HasSwitch(cefclient::kTransparentPaintingEnabled); + command_line->HasSwitch(switches::kTransparentPaintingEnabled); const bool show_update_rect = - command_line->HasSwitch(cefclient::kShowUpdateRect); + command_line->HasSwitch(switches::kShowUpdateRect); // Create the GTKGL surface. - CefRefPtr osr_window = - client::OSRWindow::Create(&g_main_browser_provider, transparent, - show_update_rect, vbox); + CefRefPtr osr_window = + OSRWindow::Create(&g_main_browser_provider, transparent, + show_update_rect, vbox); // Show the GTK window. gtk_widget_show_all(GTK_WIDGET(window)); @@ -493,3 +491,12 @@ int main(int argc, char* argv[]) { return result; } + +} // namespace +} // namespace client + + +// Program entry point function. +int main(int argc, char* argv[]) { + return client::RunMain(argc, argv); +} diff --git a/tests/cefclient/cefclient_mac.mm b/tests/cefclient/cefclient_mac.mm index e96c402dc..f430b7c1b 100644 --- a/tests/cefclient/cefclient_mac.mm +++ b/tests/cefclient/cefclient_mac.mm @@ -19,9 +19,12 @@ #include "cefclient/resource_util.h" #include "cefclient/test_runner.h" -// The global ClientHandler reference. -CefRefPtr g_handler; +namespace { +// The global ClientHandler reference. +CefRefPtr g_handler; + +// Used by off-screen rendering to find the associated CefBrowser. class MainBrowserProvider : public client::OSRBrowserProvider { virtual CefRefPtr GetBrowser() { if (g_handler.get()) @@ -31,6 +34,7 @@ class MainBrowserProvider : public client::OSRBrowserProvider { } } g_main_browser_provider; + // Sizes for URL bar layout #define BUTTON_HEIGHT 22 #define BUTTON_WIDTH 72 @@ -41,6 +45,26 @@ class MainBrowserProvider : public client::OSRBrowserProvider { const int kWindowWidth = 800; const int kWindowHeight = 600; + +NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) { + NSButton* button = [[[NSButton alloc] initWithFrame:*rect] autorelease]; + [button setTitle:title]; + [button setBezelStyle:NSSmallSquareBezelStyle]; + [button setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)]; + [parent addSubview:button]; + rect->origin.x += BUTTON_WIDTH; + return button; +} + +void AddMenuItem(NSMenu *menu, NSString* label, int idval) { + NSMenuItem* item = [menu addItemWithTitle:label + action:@selector(menuItemSelected:) + keyEquivalent:@""]; + [item setTag:idval]; +} + +} // namespace + // Receives notifications from the application. Will delete itself when done. @interface ClientAppDelegate : NSObject - (void)createApplication:(id)object; @@ -209,7 +233,7 @@ const int kWindowHeight = 600; CefRefPtr browser = g_handler->GetBrowser(); if (browser.get()) { if (CefCommandLine::GetGlobalCommandLine()->HasSwitch( - cefclient::kOffScreenRenderingEnabled)) { + client::switches::kOffScreenRenderingEnabled)) { browser->GetHost()->SendFocusEvent(true); } else { browser->GetHost()->SetFocus(true); @@ -224,7 +248,7 @@ const int kWindowHeight = 600; CefRefPtr browser = g_handler->GetBrowser(); if (browser.get()) { if (CefCommandLine::GetGlobalCommandLine()->HasSwitch( - cefclient::kOffScreenRenderingEnabled)) { + client::switches::kOffScreenRenderingEnabled)) { browser->GetHost()->SendFocusEvent(false); } else { browser->GetHost()->SetFocus(false); @@ -313,23 +337,6 @@ const int kWindowHeight = 600; @end -NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) { - NSButton* button = [[[NSButton alloc] initWithFrame:*rect] autorelease]; - [button setTitle:title]; - [button setBezelStyle:NSSmallSquareBezelStyle]; - [button setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)]; - [parent addSubview:button]; - rect->origin.x += BUTTON_WIDTH; - return button; -} - -void AddMenuItem(NSMenu *menu, NSString* label, int idval) { - NSMenuItem* item = [menu addItemWithTitle:label - action:@selector(menuItemSelected:) - keyEquivalent:@""]; - [item setTag:idval]; -} - @implementation ClientAppDelegate // Create the application on the UI thread. @@ -424,7 +431,7 @@ void AddMenuItem(NSMenu *menu, NSString* label, int idval) { [[editWnd cell] setScrollable:YES]; // Create the handler. - g_handler = new ClientHandler(); + g_handler = new client::ClientHandler(); g_handler->SetMainWindowHandle(contentView); g_handler->SetEditWindowHandle(editWnd); @@ -437,11 +444,11 @@ void AddMenuItem(NSMenu *menu, NSString* label, int idval) { CefRefPtr command_line = CefCommandLine::GetGlobalCommandLine(); - if (command_line->HasSwitch(cefclient::kOffScreenRenderingEnabled)) { + if (command_line->HasSwitch(client::switches::kOffScreenRenderingEnabled)) { const bool transparent = - command_line->HasSwitch(cefclient::kTransparentPaintingEnabled); + command_line->HasSwitch(client::switches::kTransparentPaintingEnabled); const bool show_update_rect = - command_line->HasSwitch(cefclient::kShowUpdateRect); + command_line->HasSwitch(client::switches::kShowUpdateRect); CefRefPtr osr_window = client::OSRWindow::Create(&g_main_browser_provider, transparent, @@ -486,7 +493,10 @@ void AddMenuItem(NSMenu *menu, NSString* label, int idval) { @end -int main(int argc, char* argv[]) { +namespace client { +namespace { + +int RunMain(int argc, char* argv[]) { CefMainArgs main_args(argc, argv); CefRefPtr app(new ClientApp); @@ -497,8 +507,7 @@ int main(int argc, char* argv[]) { [ClientApplication sharedApplication]; // Create the main context object. - scoped_ptr context( - new client::MainContextImpl(argc, argv)); + scoped_ptr context(new MainContextImpl(argc, argv)); CefSettings settings; @@ -506,14 +515,13 @@ int main(int argc, char* argv[]) { context->PopulateSettings(&settings); // Create the main message loop object. - scoped_ptr message_loop( - new client::MainMessageLoopStd); + scoped_ptr message_loop(new MainMessageLoopStd); // Initialize CEF. CefInitialize(main_args, settings, app.get(), NULL); // Register scheme handlers. - client::test_runner::RegisterSchemeHandlers(); + test_runner::RegisterSchemeHandlers(); // Create the application delegate and window. NSObject* delegate = [[ClientAppDelegate alloc] init]; @@ -536,3 +544,12 @@ int main(int argc, char* argv[]) { return result; } + +} // namespace +} // namespace client + + +// Program entry point function. +int main(int argc, char* argv[]) { + return client::RunMain(argc, argv); +} diff --git a/tests/cefclient/cefclient_win.cc b/tests/cefclient/cefclient_win.cc index bd5bf52df..1534e8536 100644 --- a/tests/cefclient/cefclient_win.cc +++ b/tests/cefclient/cefclient_win.cc @@ -40,6 +40,8 @@ #pragma comment(lib, "cef_sandbox.lib") #endif +namespace client { +namespace { #define MAX_LOADSTRING 100 #define MAX_URL_LENGTH 255 @@ -54,17 +56,18 @@ TCHAR szOSRWindowClass[MAX_LOADSTRING]; // the OSR window class name UINT uFindMsg; // Message identifier for find events. HWND hFindDlg = NULL; // Handle for the find dialog. -// Forward declarations of functions included in this code module: -ATOM MyRegisterClass(HINSTANCE hInstance); -BOOL InitInstance(HINSTANCE, int); -LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); -LRESULT CALLBACK FindProc(HWND, UINT, WPARAM, LPARAM); -INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); +// Forward declarations of functions included in this code module. +ATOM RegisterMainClass(HINSTANCE hInstance); +BOOL CreateMainWindow(HINSTANCE, int); +LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM); +LRESULT CALLBACK FindWndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK AboutWndProc(HWND, UINT, WPARAM, LPARAM); // The global ClientHandler reference. CefRefPtr g_handler; -class MainBrowserProvider : public client::OSRBrowserProvider { +// Used by off-screen rendering to find the associated CefBrowser. +class MainBrowserProvider : public OSRBrowserProvider { virtual CefRefPtr GetBrowser() { if (g_handler.get()) return g_handler->GetBrowser(); @@ -73,14 +76,8 @@ class MainBrowserProvider : public client::OSRBrowserProvider { } } g_main_browser_provider; -// Program entry point function. -int APIENTRY wWinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPTSTR lpCmdLine, - int nCmdShow) { - UNREFERENCED_PARAMETER(hPrevInstance); - UNREFERENCED_PARAMETER(lpCmdLine); +int RunMain(HINSTANCE hInstance, int nCmdShow) { void* sandbox_info = NULL; #if defined(CEF_USE_SANDBOX) @@ -99,8 +96,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, return exit_code; // Create the main context object. - scoped_ptr context( - new client::MainContextImpl(0, NULL)); + scoped_ptr context(new MainContextImpl(0, NULL)); CefSettings settings; @@ -112,26 +108,26 @@ int APIENTRY wWinMain(HINSTANCE hInstance, context->PopulateSettings(&settings); // Create the main message loop object. - scoped_ptr message_loop; + scoped_ptr message_loop; if (settings.multi_threaded_message_loop) - message_loop.reset(new client::MainMessageLoopMultithreadedWin); + message_loop.reset(new MainMessageLoopMultithreadedWin); else - message_loop.reset(new client::MainMessageLoopStd); + message_loop.reset(new MainMessageLoopStd); // Initialize CEF. CefInitialize(main_args, settings, app.get(), sandbox_info); // Register scheme handlers. - client::test_runner::RegisterSchemeHandlers(); + test_runner::RegisterSchemeHandlers(); // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_CEFCLIENT, szWindowClass, MAX_LOADSTRING); LoadString(hInstance, IDS_OSR_WIDGET_CLASS, szOSRWindowClass, MAX_LOADSTRING); - MyRegisterClass(hInstance); + RegisterMainClass(hInstance); // Perform application initialization - if (!InitInstance (hInstance, nCmdShow)) + if (!CreateMainWindow(hInstance, nCmdShow)) return FALSE; // Register the find event message. @@ -150,26 +146,14 @@ int APIENTRY wWinMain(HINSTANCE hInstance, return result; } -// -// FUNCTION: MyRegisterClass() -// -// PURPOSE: Registers the window class. -// -// COMMENTS: -// -// This function and its usage are only necessary if you want this code -// to be compatible with Win32 systems prior to the 'RegisterClassEx' -// function that was added to Windows 95. It is important to call this -// function so that the application will get 'well formed' small icons -// associated with it. -// -ATOM MyRegisterClass(HINSTANCE hInstance) { +// Register the main window class. +ATOM RegisterMainClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = WndProc; + wcex.lpfnWndProc = MainWndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; @@ -183,17 +167,8 @@ ATOM MyRegisterClass(HINSTANCE hInstance) { return RegisterClassEx(&wcex); } -// -// FUNCTION: InitInstance(HINSTANCE, int) -// -// PURPOSE: Saves instance handle and creates main window -// -// COMMENTS: -// -// In this function, we save the instance handle in a global variable and -// create and display the main program window. -// -BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { +// Create and show the main window. +BOOL CreateMainWindow(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable @@ -223,10 +198,10 @@ static void SetFocusToBrowser(CefRefPtr browser) { return; if (CefCommandLine::GetGlobalCommandLine()->HasSwitch( - cefclient::kOffScreenRenderingEnabled)) { + switches::kOffScreenRenderingEnabled)) { // Give focus to the OSR window. - CefRefPtr osr_window = - static_cast(g_handler->GetOSRHandler().get()); + CefRefPtr osr_window = + static_cast(g_handler->GetOSRHandler().get()); if (osr_window) ::SetFocus(osr_window->hwnd()); } else { @@ -235,13 +210,9 @@ static void SetFocusToBrowser(CefRefPtr browser) { } } -// -// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) -// -// PURPOSE: Processes messages for the main window. -// -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, - LPARAM lParam) { +// Window procedure for the main window. +LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam) { static HWND backWnd = NULL, forwardWnd = NULL, reloadWnd = NULL, stopWnd = NULL, editWnd = NULL; static WNDPROC editWndOldProc = NULL; @@ -370,7 +341,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, editWndOldProc = reinterpret_cast(GetWindowLongPtr(editWnd, GWLP_WNDPROC)); SetWindowLongPtr(editWnd, GWLP_WNDPROC, - reinterpret_cast(WndProc)); + reinterpret_cast(MainWndProc)); g_handler->SetEditWindowHandle(editWnd); g_handler->SetButtonWindowHandles( backWnd, forwardWnd, reloadWnd, stopWnd); @@ -381,19 +352,19 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, CefBrowserSettings settings; // Populate the browser settings based on command line arguments. - client::MainContext::Get()->PopulateBrowserSettings(&settings); + MainContext::Get()->PopulateBrowserSettings(&settings); CefRefPtr command_line = CefCommandLine::GetGlobalCommandLine(); - if (command_line->HasSwitch(cefclient::kOffScreenRenderingEnabled)) { + if (command_line->HasSwitch(switches::kOffScreenRenderingEnabled)) { const bool transparent = - command_line->HasSwitch(cefclient::kTransparentPaintingEnabled); + command_line->HasSwitch(switches::kTransparentPaintingEnabled); const bool show_update_rect = - command_line->HasSwitch(cefclient::kShowUpdateRect); + command_line->HasSwitch(switches::kShowUpdateRect); - CefRefPtr osr_window = - client::OSRWindow::Create(&g_main_browser_provider, transparent, - show_update_rect); + CefRefPtr osr_window = + OSRWindow::Create(&g_main_browser_provider, transparent, + show_update_rect); osr_window->CreateWidget(hWnd, rect, hInst, szOSRWindowClass); info.SetAsWindowless(osr_window->hwnd(), transparent); g_handler->SetOSRHandler(osr_window.get()); @@ -418,14 +389,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, wmEvent = HIWORD(wParam); if (wmId >= ID_TESTS_FIRST && wmId <= ID_TESTS_LAST) { - client::test_runner::RunTest(browser, wmId); + test_runner::RunTest(browser, wmId); return 0; } // Parse the menu selections: switch (wmId) { case IDM_ABOUT: - DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); + DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, AboutWndProc); return 0; case IDM_EXIT: if (g_handler.get()) @@ -444,10 +415,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, hFindDlg = FindText(&fr); // Override the dialog's window procedure. - WNDPROC wndproc_old = client::SetWndProcPtr(hFindDlg, FindProc); + WNDPROC wndproc_old = SetWndProcPtr(hFindDlg, FindWndProc); // Associate |wndproc_old| with the dialog. - client::SetUserDataPtr(hFindDlg, wndproc_old); + SetUserDataPtr(hFindDlg, wndproc_old); } else { // Give focus to the existing find dialog. ::SetFocus(hFindDlg); @@ -493,10 +464,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, // For off-screen browsers when the frame window is minimized set the // browser as hidden to reduce resource usage. const bool offscreen = CefCommandLine::GetGlobalCommandLine()->HasSwitch( - cefclient::kOffScreenRenderingEnabled); + switches::kOffScreenRenderingEnabled); if (offscreen) { - CefRefPtr osr_window = - static_cast(g_handler->GetOSRHandler().get()); + CefRefPtr osr_window = + static_cast(g_handler->GetOSRHandler().get()); if (osr_window) osr_window->WasHidden(wParam == SIZE_MINIMIZED); } @@ -593,31 +564,32 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, } } -// Message handler for the find dialog. -LRESULT CALLBACK FindProc(HWND hWnd, UINT message, WPARAM wParam, - LPARAM lParam) { +// Window procedure for the find dialog. +LRESULT CALLBACK FindWndProc(HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam) { REQUIRE_MAIN_THREAD(); - WNDPROC old_wndproc = client::GetUserDataPtr(hWnd); + WNDPROC old_wndproc = GetUserDataPtr(hWnd); DCHECK(old_wndproc); switch (message) { case WM_ACTIVATE: // Set this dialog as current when activated. - client::MainMessageLoop::Get()->SetCurrentModelessDialog( + MainMessageLoop::Get()->SetCurrentModelessDialog( wParam == 0 ? NULL : hWnd); return FALSE; case WM_NCDESTROY: // Clear the reference to |old_wndproc|. - client::SetUserDataPtr(hWnd, NULL); + SetUserDataPtr(hWnd, NULL); break; } return CallWindowProc(old_wndproc, hWnd, message, wParam, lParam); } -// Message handler for about box. -INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { +// Window procedure for the about dialog. +INT_PTR CALLBACK AboutWndProc(HWND hDlg, UINT message, WPARAM wParam, + LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: @@ -632,3 +604,17 @@ INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { } return (INT_PTR)FALSE; } + +} // namespace +} // namespace client + + +// Program entry point function. +int APIENTRY wWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) { + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + return client::RunMain(hInstance, nCmdShow); +} diff --git a/tests/cefclient/client_app.cc b/tests/cefclient/client_app.cc index 3943220b8..c23371f60 100644 --- a/tests/cefclient/client_app.cc +++ b/tests/cefclient/client_app.cc @@ -14,6 +14,8 @@ #include "include/cef_v8.h" #include "include/wrapper/cef_helpers.h" +namespace client { + ClientApp::ClientApp() { } @@ -158,3 +160,5 @@ bool ClientApp::OnProcessMessageReceived( return handled; } + +} // namespace client diff --git a/tests/cefclient/client_app.h b/tests/cefclient/client_app.h index 8b5023e50..c95ca35fc 100644 --- a/tests/cefclient/client_app.h +++ b/tests/cefclient/client_app.h @@ -13,6 +13,8 @@ #include #include "include/cef_app.h" +namespace client { + class ClientApp : public CefApp, public CefBrowserProcessHandler, public CefRenderProcessHandler { @@ -184,4 +186,6 @@ class ClientApp : public CefApp, IMPLEMENT_REFCOUNTING(ClientApp); }; +} // namespace client + #endif // CEF_TESTS_CEFCLIENT_CLIENT_APP_H_ diff --git a/tests/cefclient/client_app_delegates.cc b/tests/cefclient/client_app_delegates.cc index 10abeb067..1339b0d53 100644 --- a/tests/cefclient/client_app_delegates.cc +++ b/tests/cefclient/client_app_delegates.cc @@ -11,21 +11,23 @@ #include "cefclient/print_handler_gtk.h" #endif +namespace client { + // static void ClientApp::CreateBrowserDelegates(BrowserDelegateSet& delegates) { } // static void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { - client_renderer::CreateRenderDelegates(delegates); - client::performance_test::CreateRenderDelegates(delegates); + renderer::CreateRenderDelegates(delegates); + performance_test::CreateRenderDelegates(delegates); } // static void ClientApp::RegisterCustomSchemes( CefRefPtr registrar, std::vector& cookiable_schemes) { - client::scheme_test::RegisterCustomSchemes(registrar, cookiable_schemes); + scheme_test::RegisterCustomSchemes(registrar, cookiable_schemes); } // static @@ -37,3 +39,4 @@ CefRefPtr ClientApp::CreatePrintHandler() { #endif } +} // namespace client diff --git a/tests/cefclient/client_handler.cc b/tests/cefclient/client_handler.cc index 81a858fc9..914f41944 100644 --- a/tests/cefclient/client_handler.cc +++ b/tests/cefclient/client_handler.cc @@ -26,6 +26,8 @@ #include "cefclient/resource_util.h" #include "cefclient/test_runner.h" +namespace client { + #if defined(OS_WIN) #define NEWLINE "\r\n" #else @@ -51,7 +53,7 @@ enum client_menu_ids { int ClientHandler::browser_count_ = 0; ClientHandler::ClientHandler() - : startup_url_(client::MainContext::Get()->GetMainURL()), + : startup_url_(MainContext::Get()->GetMainURL()), browser_id_(0), is_closing_(false), main_handle_(NULL), @@ -60,7 +62,7 @@ ClientHandler::ClientHandler() forward_handle_(NULL), stop_handle_(NULL), reload_handle_(NULL), - console_log_file_(client::MainContext::Get()->GetConsoleLogPath()), + console_log_file_(MainContext::Get()->GetConsoleLogPath()), first_console_message_(true), focus_on_editable_field_(false) { #if defined(OS_LINUX) @@ -73,7 +75,7 @@ ClientHandler::ClientHandler() CefRefPtr command_line = CefCommandLine::GetGlobalCommandLine(); mouse_cursor_change_disabled_ = - command_line->HasSwitch(cefclient::kMouseCursorChangeDisabled); + command_line->HasSwitch(switches::kMouseCursorChangeDisabled); } ClientHandler::~ClientHandler() { @@ -92,7 +94,7 @@ bool ClientHandler::OnProcessMessageReceived( // Check for messages from the client renderer. std::string message_name = message->GetName(); - if (message_name == client_renderer::kFocusedNodeChangedMessage) { + if (message_name == renderer::kFocusedNodeChangedMessage) { // A message is sent from ClientRenderDelegate to tell us whether the // currently focused DOM node is editable. Use of |focus_on_editable_field_| // is redundant with CefKeyEvent.focus_on_editable_field in OnPreKeyEvent @@ -183,7 +185,7 @@ bool ClientHandler::OnConsoleMessage(CefRefPtr browser, fclose(file); if (first_console_message_) { - client::test_runner::Alert( + test_runner::Alert( browser, "Console messages written to \"" + console_log_file_ + "\""); first_console_message_ = false; } @@ -200,8 +202,7 @@ void ClientHandler::OnBeforeDownload( CEF_REQUIRE_UI_THREAD(); // Continue the download and show the "Save As" dialog. - callback->Continue( - client::MainContext::Get()->GetDownloadPath(suggested_name), true); + callback->Continue(MainContext::Get()->GetDownloadPath(suggested_name), true); } void ClientHandler::OnDownloadUpdated( @@ -211,7 +212,7 @@ void ClientHandler::OnDownloadUpdated( CEF_REQUIRE_UI_THREAD(); if (download_item->IsComplete()) { - client::test_runner::Alert( + test_runner::Alert( browser, "File \"" + download_item->GetFullPath().ToString() + "\" downloaded successfully."); @@ -320,7 +321,7 @@ void ClientHandler::OnAfterCreated(CefRefPtr browser) { message_router_ = CefMessageRouterBrowserSide::Create(config); // Register handlers with the router. - client::test_runner::CreateMessageHandlers(message_handler_set_); + test_runner::CreateMessageHandlers(message_handler_set_); MessageHandlerSet::const_iterator it = message_handler_set_.begin(); for (; it != message_handler_set_.end(); ++it) message_router_->AddHandler(*(it), false); @@ -404,7 +405,7 @@ void ClientHandler::OnBeforeClose(CefRefPtr browser) { message_router_ = NULL; // Quit the application message loop. - client::MainMessageLoop::Get()->Quit(); + MainMessageLoop::Get()->Quit(); } } @@ -461,7 +462,7 @@ CefRefPtr ClientHandler::GetResourceHandler( CefRefPtr frame, CefRefPtr request) { CEF_REQUIRE_IO_THREAD(); - return client::test_runner::GetResourceHandler(browser, frame, request); + return test_runner::GetResourceHandler(browser, frame, request); } bool ClientHandler::OnQuotaRequest(CefRefPtr browser, @@ -765,3 +766,5 @@ bool ClientHandler::ExecuteTestMenu(int command_id) { // Allow default handling to proceed. return false; } + +} // namespace client diff --git a/tests/cefclient/client_handler.h b/tests/cefclient/client_handler.h index 1741ebc17..ee9132841 100644 --- a/tests/cefclient/client_handler.h +++ b/tests/cefclient/client_handler.h @@ -28,6 +28,8 @@ // window. // #define TEST_REDIRECT_POPUP_URLS +namespace client { + // ClientHandler implementation. class ClientHandler : public CefClient, public CefContextMenuHandler, @@ -374,4 +376,6 @@ class ClientHandler : public CefClient, IMPLEMENT_REFCOUNTING(ClientHandler); }; +} // namespace client + #endif // CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_ diff --git a/tests/cefclient/client_handler_gtk.cc b/tests/cefclient/client_handler_gtk.cc index 2869961bd..b1718f070 100644 --- a/tests/cefclient/client_handler_gtk.cc +++ b/tests/cefclient/client_handler_gtk.cc @@ -15,6 +15,8 @@ #include "include/cef_frame.h" #include "include/cef_url.h" +namespace client { + namespace { const char kPromptTextId[] = "cef_prompt_text"; @@ -478,3 +480,5 @@ void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) { else gtk_widget_set_sensitive(GTK_WIDGET(forward_handle_), false); } + +} // namespace client diff --git a/tests/cefclient/client_handler_mac.mm b/tests/cefclient/client_handler_mac.mm index 8d461bf9f..f80bbe424 100644 --- a/tests/cefclient/client_handler_mac.mm +++ b/tests/cefclient/client_handler_mac.mm @@ -8,6 +8,8 @@ #include "include/cef_browser.h" #include "include/cef_frame.h" +namespace client { + void ClientHandler::OnAddressChange(CefRefPtr browser, CefRefPtr frame, const CefString& url) { @@ -41,3 +43,5 @@ void ClientHandler::SetLoading(bool isLoading) { void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) { // TODO(port): Change button status. } + +} // namespace client diff --git a/tests/cefclient/client_handler_win.cc b/tests/cefclient/client_handler_win.cc index 769f6da31..9dbb455eb 100644 --- a/tests/cefclient/client_handler_win.cc +++ b/tests/cefclient/client_handler_win.cc @@ -11,6 +11,8 @@ #include "include/cef_frame.h" #include "cefclient/resource.h" +namespace client { + void ClientHandler::OnAddressChange(CefRefPtr browser, CefRefPtr frame, const CefString& url) { @@ -48,3 +50,5 @@ void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) { EnableWindow(back_handle_, canGoBack); EnableWindow(forward_handle_, canGoForward); } + +} // namespace client diff --git a/tests/cefclient/client_renderer.cc b/tests/cefclient/client_renderer.cc index 9c98db8f4..1128a99bb 100644 --- a/tests/cefclient/client_renderer.cc +++ b/tests/cefclient/client_renderer.cc @@ -11,7 +11,8 @@ #include "include/wrapper/cef_helpers.h" #include "include/wrapper/cef_message_router.h" -namespace client_renderer { +namespace client { +namespace renderer { const char kFocusedNodeChangedMessage[] = "ClientRenderer.FocusedNodeChanged"; @@ -82,4 +83,5 @@ void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) { delegates.insert(new ClientRenderDelegate); } -} // namespace client_renderer +} // namespace renderer +} // namespace client diff --git a/tests/cefclient/client_renderer.h b/tests/cefclient/client_renderer.h index 37b08408d..07c4d7cf6 100644 --- a/tests/cefclient/client_renderer.h +++ b/tests/cefclient/client_renderer.h @@ -9,7 +9,8 @@ #include "include/cef_base.h" #include "cefclient/client_app.h" -namespace client_renderer { +namespace client { +namespace renderer { // Message sent when the focused node changes. extern const char kFocusedNodeChangedMessage[]; @@ -17,6 +18,7 @@ extern const char kFocusedNodeChangedMessage[]; // Create the render delegate. void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates); -} // namespace client_renderer +} // namespace renderer +} // namespace client #endif // CEF_TESTS_CEFCLIENT_CLIENT_RENDERER_H_ diff --git a/tests/cefclient/client_switches.cc b/tests/cefclient/client_switches.cc index 4e294d2dc..161959dda 100644 --- a/tests/cefclient/client_switches.cc +++ b/tests/cefclient/client_switches.cc @@ -6,7 +6,8 @@ // a qualified path. #include "client_switches.h" // NOLINT(build/include) -namespace cefclient { +namespace client { +namespace switches { // CEF and Chromium support a wide range of command-line switches. This file // only contains command-line switches specific to the cefclient application. @@ -27,4 +28,5 @@ const char kTransparentPaintingEnabled[] = "transparent-painting-enabled"; const char kShowUpdateRect[] = "show-update-rect"; const char kMouseCursorChangeDisabled[] = "mouse-cursor-change-disabled"; -} // namespace cefclient +} // namespace switches +} // namespace client diff --git a/tests/cefclient/client_switches.h b/tests/cefclient/client_switches.h index 2eb2202ea..224b138a0 100644 --- a/tests/cefclient/client_switches.h +++ b/tests/cefclient/client_switches.h @@ -8,7 +8,8 @@ #define CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_ #pragma once -namespace cefclient { +namespace client { +namespace switches { extern const char kMultiThreadedMessageLoop[]; extern const char kCachePath[]; @@ -19,6 +20,7 @@ extern const char kTransparentPaintingEnabled[]; extern const char kShowUpdateRect[]; extern const char kMouseCursorChangeDisabled[]; -} // namespace cefclient +} // namespace switches +} // namespace client #endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_ diff --git a/tests/cefclient/main_context_impl.cc b/tests/cefclient/main_context_impl.cc index 03fb401d4..783ab2d7b 100644 --- a/tests/cefclient/main_context_impl.cc +++ b/tests/cefclient/main_context_impl.cc @@ -26,8 +26,8 @@ MainContextImpl::MainContextImpl(int argc, #endif // Set the main URL. - if (command_line_->HasSwitch(cefclient::kUrl)) - main_url_ = command_line_->GetSwitchValue(cefclient::kUrl); + if (command_line_->HasSwitch(switches::kUrl)) + main_url_ = command_line_->GetSwitchValue(switches::kUrl); if (main_url_.empty()) main_url_ = kDefaultUrl; } @@ -43,20 +43,20 @@ std::string MainContextImpl::GetMainURL() { void MainContextImpl::PopulateSettings(CefSettings* settings) { #if defined(OS_WIN) settings->multi_threaded_message_loop = - command_line_->HasSwitch(cefclient::kMultiThreadedMessageLoop); + command_line_->HasSwitch(switches::kMultiThreadedMessageLoop); #endif CefString(&settings->cache_path) = - command_line_->GetSwitchValue(cefclient::kCachePath); + command_line_->GetSwitchValue(switches::kCachePath); - if (command_line_->HasSwitch(cefclient::kOffScreenRenderingEnabled)) + if (command_line_->HasSwitch(switches::kOffScreenRenderingEnabled)) settings->windowless_rendering_enabled = true; } void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) { - if (command_line_->HasSwitch(cefclient::kOffScreenFrameRate)) { + if (command_line_->HasSwitch(switches::kOffScreenFrameRate)) { settings->windowless_frame_rate = atoi(command_line_-> - GetSwitchValue(cefclient::kOffScreenFrameRate).ToString().c_str()); + GetSwitchValue(switches::kOffScreenFrameRate).ToString().c_str()); } } diff --git a/tests/cefclient/osr_widget_mac.mm b/tests/cefclient/osr_widget_mac.mm index 0a98810ed..628c24b60 100644 --- a/tests/cefclient/osr_widget_mac.mm +++ b/tests/cefclient/osr_widget_mac.mm @@ -1021,7 +1021,8 @@ void ClientOSRHandler::SetLoading(bool isLoading) { } else if ([type isEqualToString:(NSString*)fileUTI_]) { size_t size = current_drag_data_->GetFileContents(NULL); DCHECK_GT(size, 0U); - CefRefPtr handler = new BytesWriteHandler(size); + CefRefPtr handler = + new client::BytesWriteHandler(size); CefRefPtr writer = CefStreamWriter::CreateForHandler(handler.get()); current_drag_data_->GetFileContents(writer); diff --git a/tests/cefclient/process_helper_mac.cc b/tests/cefclient/process_helper_mac.cc index add658caf..fe16a5303 100644 --- a/tests/cefclient/process_helper_mac.cc +++ b/tests/cefclient/process_helper_mac.cc @@ -12,7 +12,7 @@ int main(int argc, char* argv[]) { CefMainArgs main_args(argc, argv); - CefRefPtr app(new ClientApp); + CefRefPtr app(new client::ClientApp); // Execute the secondary process. return CefExecuteProcess(main_args, app, NULL); diff --git a/tests/cefclient/resource_util.h b/tests/cefclient/resource_util.h index d38830792..568feeea3 100644 --- a/tests/cefclient/resource_util.h +++ b/tests/cefclient/resource_util.h @@ -9,6 +9,8 @@ #include #include "include/cef_stream.h" +namespace client { + #if defined(OS_POSIX) // Returns the directory containing resource files. bool GetResourceDir(std::string& dir); @@ -20,4 +22,6 @@ bool LoadBinaryResource(const char* resource_name, std::string& resource_data); // Retrieve a resource as a steam reader. CefRefPtr GetBinaryResourceReader(const char* resource_name); +} // namespace client + #endif // CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_ diff --git a/tests/cefclient/resource_util_linux.cc b/tests/cefclient/resource_util_linux.cc index 8b5c822e0..408bf10c2 100644 --- a/tests/cefclient/resource_util_linux.cc +++ b/tests/cefclient/resource_util_linux.cc @@ -8,6 +8,8 @@ #include #include +namespace client { + bool GetResourceDir(std::string& dir) { char buff[1024]; @@ -28,3 +30,5 @@ bool GetResourceDir(std::string& dir) { dir = std::string(buff); return true; } + +} // namespace client diff --git a/tests/cefclient/resource_util_mac.mm b/tests/cefclient/resource_util_mac.mm index 7bf6d882e..3b8ed96f4 100644 --- a/tests/cefclient/resource_util_mac.mm +++ b/tests/cefclient/resource_util_mac.mm @@ -11,6 +11,8 @@ #include "include/base/cef_logging.h" +namespace client { + namespace { bool AmIBundled() { @@ -59,3 +61,5 @@ bool GetResourceDir(std::string& dir) { return false; } } + +} // namespace client diff --git a/tests/cefclient/resource_util_posix.cc b/tests/cefclient/resource_util_posix.cc index 68a4331f6..96dfa5706 100644 --- a/tests/cefclient/resource_util_posix.cc +++ b/tests/cefclient/resource_util_posix.cc @@ -5,6 +5,8 @@ #include "cefclient/resource_util.h" #include +namespace client { + namespace { bool FileExists(const char* path) { @@ -57,3 +59,5 @@ CefRefPtr GetBinaryResourceReader(const char* resource_name) { return CefStreamReader::CreateForFile(path); } + +} // namespace client diff --git a/tests/cefclient/resource_util_win.cc b/tests/cefclient/resource_util_win.cc index 8ec83131d..c4314df55 100644 --- a/tests/cefclient/resource_util_win.cc +++ b/tests/cefclient/resource_util_win.cc @@ -8,6 +8,8 @@ #include "include/wrapper/cef_byte_read_handler.h" #include "cefclient/resource.h" +namespace client { + namespace { bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes) { @@ -89,3 +91,5 @@ CefRefPtr GetBinaryResourceReader(const char* resource_name) { NOTREACHED(); // The resource should be found. return NULL; } + +} // namespace client diff --git a/tests/cefclient/test_runner.cc b/tests/cefclient/test_runner.cc index 2ef8aca05..7cd48a0c3 100644 --- a/tests/cefclient/test_runner.cc +++ b/tests/cefclient/test_runner.cc @@ -186,8 +186,7 @@ void EndTracing(CefRefPtr browser) { void RunDialog() { static const char kDefaultFileName[] = "trace.txt"; - std::string path = - client::MainContext::Get()->GetDownloadPath(kDefaultFileName); + std::string path = MainContext::Get()->GetDownloadPath(kDefaultFileName); if (path.empty()) path = kDefaultFileName; diff --git a/tests/unittests/client_app_delegates.cc b/tests/unittests/client_app_delegates.cc index c2a49cf7b..ad8379799 100644 --- a/tests/unittests/client_app_delegates.cc +++ b/tests/unittests/client_app_delegates.cc @@ -4,33 +4,39 @@ #include "tests/cefclient/client_app.h" -// static -void ClientApp::CreateBrowserDelegates(BrowserDelegateSet& delegates) { +using client::ClientApp; + +void CreateBrowserDelegates(ClientApp::BrowserDelegateSet& delegates) { // Bring in the Frame tests. - extern void CreateFrameBrowserTests(BrowserDelegateSet& delegates); + extern void CreateFrameBrowserTests( + ClientApp::BrowserDelegateSet& delegates); CreateFrameBrowserTests(delegates); // Bring in the Navigation tests. - extern void CreateNavigationBrowserTests(BrowserDelegateSet& delegates); + extern void CreateNavigationBrowserTests( + ClientApp::BrowserDelegateSet& delegates); CreateNavigationBrowserTests(delegates); // Bring in the RequestHandler tests. - extern void CreateRequestHandlerBrowserTests(BrowserDelegateSet& delegates); + extern void CreateRequestHandlerBrowserTests( + ClientApp::BrowserDelegateSet& delegates); CreateRequestHandlerBrowserTests(delegates); // Bring in the V8 tests. - extern void CreateV8BrowserTests(BrowserDelegateSet& delegates); + extern void CreateV8BrowserTests( + ClientApp::BrowserDelegateSet& delegates); CreateV8BrowserTests(delegates); } -// static -void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { +void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) { // Bring in the Frame tests. - extern void CreateFrameRendererTests(RenderDelegateSet& delegates); + extern void CreateFrameRendererTests( + ClientApp::RenderDelegateSet& delegates); CreateFrameRendererTests(delegates); // Bring in the DOM tests. - extern void CreateDOMRendererTests(RenderDelegateSet& delegates); + extern void CreateDOMRendererTests( + ClientApp::RenderDelegateSet& delegates); CreateDOMRendererTests(delegates); // Bring in the message router tests. @@ -39,7 +45,8 @@ void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { CreateMessageRouterRendererTests(delegates); // Bring in the Navigation tests. - extern void CreateNavigationRendererTests(RenderDelegateSet& delegates); + extern void CreateNavigationRendererTests( + ClientApp::RenderDelegateSet& delegates); CreateNavigationRendererTests(delegates); // Bring in the process message tests. @@ -48,11 +55,13 @@ void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { CreateProcessMessageRendererTests(delegates); // Bring in the RequestHandler tests. - extern void CreateRequestHandlerRendererTests(RenderDelegateSet& delegates); + extern void CreateRequestHandlerRendererTests( + ClientApp::RenderDelegateSet& delegates); CreateRequestHandlerRendererTests(delegates); // Bring in the Request tests. - extern void CreateRequestRendererTests(RenderDelegateSet& delegates); + extern void CreateRequestRendererTests( + ClientApp::RenderDelegateSet& delegates); CreateRequestRendererTests(delegates); // Bring in the routing test handler delegate. @@ -61,16 +70,17 @@ void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { CreateRoutingTestHandlerDelegate(delegates); // Bring in the URLRequest tests. - extern void CreateURLRequestRendererTests(RenderDelegateSet& delegates); + extern void CreateURLRequestRendererTests( + ClientApp::RenderDelegateSet& delegates); CreateURLRequestRendererTests(delegates); // Bring in the V8 tests. - extern void CreateV8RendererTests(RenderDelegateSet& delegates); + extern void CreateV8RendererTests( + ClientApp::RenderDelegateSet& delegates); CreateV8RendererTests(delegates); } -// static -void ClientApp::RegisterCustomSchemes( +void RegisterCustomSchemes( CefRefPtr registrar, std::vector& cookiable_schemes) { // Bring in the scheme handler tests. @@ -92,8 +102,30 @@ void ClientApp::RegisterCustomSchemes( RegisterURLRequestCustomSchemes(registrar, cookiable_schemes); } + +namespace client { + +// static +void ClientApp::CreateBrowserDelegates(BrowserDelegateSet& delegates) { + ::CreateBrowserDelegates(delegates); +} + +// static +void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { + ::CreateRenderDelegates(delegates); +} + +// static +void ClientApp::RegisterCustomSchemes( + CefRefPtr registrar, + std::vector& cookiable_schemes) { + ::RegisterCustomSchemes(registrar, cookiable_schemes); +} + // static CefRefPtr ClientApp::CreatePrintHandler() { return NULL; } +} // namespace client + diff --git a/tests/unittests/dom_unittest.cc b/tests/unittests/dom_unittest.cc index 255b59920..dd3b13536 100644 --- a/tests/unittests/dom_unittest.cc +++ b/tests/unittests/dom_unittest.cc @@ -10,6 +10,8 @@ #include "tests/cefclient/client_app.h" #include "tests/unittests/test_handler.h" +using client::ClientApp; + namespace { const char* kTestUrl = "http://tests/DOMTest.Test"; diff --git a/tests/unittests/frame_unittest.cc b/tests/unittests/frame_unittest.cc index 1fd3806f8..1f7edf6ad 100644 --- a/tests/unittests/frame_unittest.cc +++ b/tests/unittests/frame_unittest.cc @@ -13,6 +13,8 @@ #include "tests/cefclient/client_app.h" #include "tests/unittests/test_handler.h" +using client::ClientApp; + namespace { // The frame navigation test harness work as follows: diff --git a/tests/unittests/message_router_unittest.cc b/tests/unittests/message_router_unittest.cc index de6c97233..47321cbe6 100644 --- a/tests/unittests/message_router_unittest.cc +++ b/tests/unittests/message_router_unittest.cc @@ -19,6 +19,8 @@ #include "tests/unittests/routing_test_handler.h" #include "tests/cefclient/client_app.h" +using client::ClientApp; + namespace { const char kTestDomainRoot[] = "http://tests-mr"; diff --git a/tests/unittests/navigation_unittest.cc b/tests/unittests/navigation_unittest.cc index 0daa11165..3d21f8c0d 100644 --- a/tests/unittests/navigation_unittest.cc +++ b/tests/unittests/navigation_unittest.cc @@ -17,6 +17,8 @@ #include "tests/unittests/test_handler.h" #include "tests/unittests/test_util.h" +using client::ClientApp; + namespace { const char kHNav1[] = "http://tests-hnav/nav1.html"; diff --git a/tests/unittests/os_rendering_unittest.cc b/tests/unittests/os_rendering_unittest.cc index 65aca5f2b..497922df5 100644 --- a/tests/unittests/os_rendering_unittest.cc +++ b/tests/unittests/os_rendering_unittest.cc @@ -300,7 +300,7 @@ class OSRTestHandler : public RoutingTestHandler, if (url.find(kTestUrl) == 0) { // Show the osr test contents CefRefPtr stream = - GetBinaryResourceReader("osr_test.html"); + client::GetBinaryResourceReader("osr_test.html"); return new CefStreamResourceHandler("text/html", stream); } diff --git a/tests/unittests/process_message_unittest.cc b/tests/unittests/process_message_unittest.cc index 461552463..12ad6bd28 100644 --- a/tests/unittests/process_message_unittest.cc +++ b/tests/unittests/process_message_unittest.cc @@ -12,6 +12,8 @@ #include "tests/unittests/test_handler.h" #include "tests/unittests/test_util.h" +using client::ClientApp; + namespace { // Unique values for the SendRecv test. diff --git a/tests/unittests/request_handler_unittest.cc b/tests/unittests/request_handler_unittest.cc index 866bd969f..37c97e147 100644 --- a/tests/unittests/request_handler_unittest.cc +++ b/tests/unittests/request_handler_unittest.cc @@ -14,6 +14,8 @@ #include "tests/cefclient/client_app.h" #include "tests/unittests/test_handler.h" +using client::ClientApp; + namespace { enum NetNotifyTestType { diff --git a/tests/unittests/request_unittest.cc b/tests/unittests/request_unittest.cc index b96a9fabe..2755bc1ac 100644 --- a/tests/unittests/request_unittest.cc +++ b/tests/unittests/request_unittest.cc @@ -15,6 +15,8 @@ #include "tests/unittests/test_handler.h" #include "tests/unittests/test_util.h" +using client::ClientApp; + // Verify Set/Get methods for CefRequest, CefPostData and CefPostDataElement. TEST(RequestTest, SetGet) { // CefRequest CreateRequest diff --git a/tests/unittests/routing_test_handler.cc b/tests/unittests/routing_test_handler.cc index b5563768b..075c92ec2 100644 --- a/tests/unittests/routing_test_handler.cc +++ b/tests/unittests/routing_test_handler.cc @@ -8,6 +8,8 @@ #include "tests/unittests/routing_test_handler.h" #include "tests/cefclient/client_app.h" +using client::ClientApp; + namespace { void SetRouterConfig(CefMessageRouterConfig& config) { diff --git a/tests/unittests/run_all_unittests.cc b/tests/unittests/run_all_unittests.cc index 0604b92ef..02080fb81 100644 --- a/tests/unittests/run_all_unittests.cc +++ b/tests/unittests/run_all_unittests.cc @@ -27,6 +27,8 @@ #include "include/cef_sandbox_win.h" #endif +using client::ClientApp; + namespace { // Thread used to run the test suite. @@ -107,7 +109,7 @@ int main(int argc, char* argv[]) { windows_sandbox_info = scoped_sandbox.sandbox_info(); #endif - CefRefPtr app(new ClientApp); + CefRefPtr app(new client::ClientApp); // Execute the secondary process, if any. int exit_code = CefExecuteProcess(main_args, app, windows_sandbox_info); diff --git a/tests/unittests/test_suite.cc b/tests/unittests/test_suite.cc index 2b11a7d1d..a362af7c0 100644 --- a/tests/unittests/test_suite.cc +++ b/tests/unittests/test_suite.cc @@ -48,11 +48,11 @@ void CefTestSuite::InitCommandLine(int argc, const char* const* argv) { void CefTestSuite::GetSettings(CefSettings& settings) { #if defined(OS_WIN) settings.multi_threaded_message_loop = - commandline_->HasSwitch(cefclient::kMultiThreadedMessageLoop); + commandline_->HasSwitch(client::switches::kMultiThreadedMessageLoop); #endif CefString(&settings.cache_path) = - commandline_->GetSwitchValueASCII(cefclient::kCachePath); + commandline_->GetSwitchValueASCII(client::switches::kCachePath); // Always expose the V8 gc() function to give tests finer-grained control over // memory management. @@ -75,9 +75,9 @@ void CefTestSuite::GetSettings(CefSettings& settings) { bool CefTestSuite::GetCachePath(std::string& path) { DCHECK(commandline_); - if (commandline_->HasSwitch(cefclient::kCachePath)) { + if (commandline_->HasSwitch(client::switches::kCachePath)) { // Set the cache_path value. - path = commandline_->GetSwitchValueASCII(cefclient::kCachePath); + path = commandline_->GetSwitchValueASCII(client::switches::kCachePath); return true; } diff --git a/tests/unittests/urlrequest_unittest.cc b/tests/unittests/urlrequest_unittest.cc index 737624114..3cf38bd68 100644 --- a/tests/unittests/urlrequest_unittest.cc +++ b/tests/unittests/urlrequest_unittest.cc @@ -23,6 +23,8 @@ #include "tests/unittests/test_handler.h" #include "tests/unittests/test_util.h" +using client::ClientApp; + // How to add a new test: // 1. Add a new value to the RequestTestMode enumeration. // 2. Add methods to set up and run the test in RequestTestRunner. diff --git a/tests/unittests/v8_unittest.cc b/tests/unittests/v8_unittest.cc index 44fd7af7b..71497c58a 100644 --- a/tests/unittests/v8_unittest.cc +++ b/tests/unittests/v8_unittest.cc @@ -15,6 +15,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/test_handler.h" +using client::ClientApp; + // How to add a new test: // 1. Add a new value to the V8TestMode enumeration. // 2. Add a method that implements the test in V8RendererTest.