Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log_browsertest.cc

Issue 19234003: Extension activity log database refactoring (step 2) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add a comment lost in the rebase Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "base/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "chrome/browser/extensions/activity_log/activity_log.h" 6 #include "chrome/browser/extensions/activity_log/activity_log.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/prerender/prerender_handle.h" 9 #include "chrome/browser/prerender/prerender_handle.h"
10 #include "chrome/browser/prerender/prerender_manager.h" 10 #include "chrome/browser/prerender/prerender_manager.h"
(...skipping 16 matching lines...) Expand all
27 protected: 27 protected:
28 // Make sure the activity log is turned on. 28 // Make sure the activity log is turned on.
29 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 29 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
30 ExtensionBrowserTest::SetUpCommandLine(command_line); 30 ExtensionBrowserTest::SetUpCommandLine(command_line);
31 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging); 31 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging);
32 command_line->AppendSwitch(switches::kEnableExtensionActivityLogTesting); 32 command_line->AppendSwitch(switches::kEnableExtensionActivityLogTesting);
33 command_line->AppendSwitchASCII(switches::kPrerenderMode, 33 command_line->AppendSwitchASCII(switches::kPrerenderMode,
34 switches::kPrerenderModeSwitchValueEnabled); 34 switches::kPrerenderModeSwitchValueEnabled);
35 } 35 }
36 36
37 static void Prerender_Arguments(int port, 37 static void Prerender_Arguments(
38 const std::string& extension_id,
39 int port,
38 scoped_ptr<std::vector<scoped_refptr<Action> > > i) { 40 scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
39 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below 41 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below
40 base::MessageLoop::current()->PostTask( 42 base::MessageLoop::current()->PostTask(
41 FROM_HERE, base::MessageLoop::QuitClosure()); 43 FROM_HERE, base::MessageLoop::QuitClosure());
42 44
43 ASSERT_TRUE(i->size()); 45 ASSERT_TRUE(i->size());
44 scoped_refptr<Action> last = i->front(); 46 scoped_refptr<Action> last = i->front();
45 47
46 std::string args = base::StringPrintf( 48 std::string args = base::StringPrintf(
47 "Injected scripts (\"/google_cs.js \") " 49 "ID=%s CATEGORY=content_script API= "
48 "onto http://www.google.com.bo:%d/test.html (prerender)", 50 "ARGS=[\"\\\"/google_cs.js \\\"\"] "
49 port); 51 "PAGE_URL=http://www.google.com.bo:%d/test.html OTHER={\"dom_verb\":3,\" extra\":\"(prerender)\",\"page_title\":\"www.google.com.bo:%d/test.html\"}",
felt 2013/07/18 17:09:59 line wrap
mvrable 2013/07/18 18:20:34 Done.
52 extension_id.c_str(), port, port);
50 // TODO: Replace PrintForDebug with field testing 53 // TODO: Replace PrintForDebug with field testing
51 // when this feature will be available 54 // when this feature will be available
52 ASSERT_EQ(args, last->PrintForDebug()); 55 ASSERT_EQ(args, last->PrintForDebug());
53 } 56 }
54 }; 57 };
55 58
56 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) { 59 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) {
57 host_resolver()->AddRule("*", "127.0.0.1"); 60 host_resolver()->AddRule("*", "127.0.0.1");
58 StartEmbeddedTestServer(); 61 StartEmbeddedTestServer();
59 int port = embedded_test_server()->port(); 62 int port = embedded_test_server()->port();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 scoped_ptr<prerender::PrerenderHandle> prerender_handle( 94 scoped_ptr<prerender::PrerenderHandle> prerender_handle(
92 prerender_manager->AddPrerenderFromLocalPredictor( 95 prerender_manager->AddPrerenderFromLocalPredictor(
93 url, 96 url,
94 web_contents->GetController().GetSessionStorageNamespace(), 97 web_contents->GetController().GetSessionStorageNamespace(),
95 kSize)); 98 kSize));
96 99
97 page_observer.Wait(); 100 page_observer.Wait();
98 101
99 activity_log->GetActions( 102 activity_log->GetActions(
100 ext->id(), 0, base::Bind( 103 ext->id(), 0, base::Bind(
101 ActivityLogPrerenderTest::Prerender_Arguments, port)); 104 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port));
102 105
103 // Allow invocation of Prerender_Arguments 106 // Allow invocation of Prerender_Arguments
104 base::MessageLoop::current()->Run(); 107 base::MessageLoop::current()->Run();
105 } 108 }
106 109
107 } // namespace extensions 110 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698