| Index: chrome/browser/fast_shutdown_browsertest.cc
|
| ===================================================================
|
| --- chrome/browser/fast_shutdown_browsertest.cc (revision 153070)
|
| +++ chrome/browser/fast_shutdown_browsertest.cc (working copy)
|
| @@ -5,11 +5,12 @@
|
| #include "base/bind.h"
|
| #include "base/command_line.h"
|
| #include "base/file_path.h"
|
| -#include "base/synchronization/waitable_event.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_commands.h"
|
| #include "chrome/browser/ui/browser_list.h"
|
| +#include "chrome/browser/ui/browser_tabstrip.h"
|
| +#include "chrome/browser/ui/tab_contents/tab_contents.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/test/automation/automation_proxy.h"
|
| @@ -19,54 +20,15 @@
|
| #include "chrome/test/base/ui_test_utils.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/notification_service.h"
|
| -#include "net/cookies/cookie_store.h"
|
| -#include "net/url_request/url_request_context.h"
|
| -#include "net/url_request/url_request_context_getter.h"
|
| +#include "content/public/test/browser_test_utils.h"
|
|
|
| using content::BrowserThread;
|
|
|
| -namespace {
|
| -
|
| -void GetCookiesCallback(std::string* cookies_out,
|
| - base::WaitableEvent* event,
|
| - const std::string& cookies) {
|
| - *cookies_out = cookies;
|
| - event->Signal();
|
| -}
|
| -
|
| -void GetCookiesOnIOThread(const GURL& url,
|
| - net::URLRequestContextGetter* context_getter,
|
| - base::WaitableEvent* event,
|
| - std::string* cookies) {
|
| - net::CookieStore* cookie_store =
|
| - context_getter->GetURLRequestContext()->cookie_store();
|
| - cookie_store->GetCookiesWithOptionsAsync(
|
| - url, net::CookieOptions(),
|
| - base::Bind(&GetCookiesCallback,
|
| - base::Unretained(cookies), base::Unretained(event)));
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| class FastShutdown : public InProcessBrowserTest {
|
| protected:
|
| FastShutdown() {
|
| }
|
|
|
| - std::string GetCookies(const GURL& url) {
|
| - std::string cookies;
|
| - base::WaitableEvent event(true, false);
|
| - net::URLRequestContextGetter* context_getter =
|
| - browser()->profile()->GetRequestContext();
|
| -
|
| - BrowserThread::PostTask(
|
| - BrowserThread::IO, FROM_HERE,
|
| - base::Bind(&GetCookiesOnIOThread, url,
|
| - make_scoped_refptr(context_getter), &event, &cookies));
|
| - event.Wait();
|
| - return cookies;
|
| - }
|
| -
|
| virtual void SetUpCommandLine(CommandLine* command_line) {
|
| command_line->AppendSwitch(switches::kDisablePopupBlocking);
|
| }
|
| @@ -85,7 +47,8 @@
|
| ASSERT_TRUE(test_server()->Start());
|
| // This page has an unload handler.
|
| GURL url = test_server()->GetURL("files/fast_shutdown/on_unloader.html");
|
| - EXPECT_EQ("", GetCookies(url));
|
| + TabContents* tab = chrome::GetActiveTabContents(browser());
|
| + EXPECT_EQ("", content::GetCookies(tab->profile(), url));
|
|
|
| content::WindowedNotificationObserver window_observer(
|
| chrome::NOTIFICATION_BROWSER_WINDOW_READY,
|
| @@ -110,7 +73,6 @@
|
| chrome::CloseTab(browser());
|
| renderer_shutdown_observer.Wait();
|
|
|
| -
|
| - EXPECT_EQ("unloaded=ohyeah", GetCookies(url));
|
| + EXPECT_EQ("unloaded=ohyeah", content::GetCookies(tab->profile(), url));
|
| }
|
| #endif
|
|
|