当前位置: 首页>>代码示例>>C++>>正文


C++ Persistent::get方法代码示例

本文整理汇总了C++中Persistent::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Persistent::get方法的具体用法?C++ Persistent::get怎么用?C++ Persistent::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Persistent的用法示例。


在下文中一共展示了Persistent::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: runShadowDOMTest

void TouchActionTest::runShadowDOMTest(std::string file) {
  TouchActionTrackingWebViewClient client;

  WebView* webView = setupTest(file, client);

  TrackExceptionState es;

  // Oilpan: see runTouchActionTest() comment why these are persistent
  // references.
  Persistent<Document> document =
      static_cast<Document*>(webView->mainFrame()->document());
  Persistent<StaticElementList> hostNodes =
      document->querySelectorAll("[shadow-host]", es);
  ASSERT_FALSE(es.hadException());
  ASSERT_GE(hostNodes->length(), 1u);

  for (unsigned index = 0; index < hostNodes->length(); index++) {
    ShadowRoot* shadowRoot = hostNodes->item(index)->openShadowRoot();
    runTestOnTree(shadowRoot, webView, client);
  }

  // Projections show up in the main document.
  runTestOnTree(document.get(), webView, client);

  // Explicitly reset to break dependency on locally scoped client.
  m_webViewHelper.reset();
}
开发者ID:mirror,项目名称:chromium,代码行数:27,代码来源:TouchActionTest.cpp

示例2: KURL

TEST(LinkLoaderTest, Preconnect) {
  struct {
    const char* href;
    CrossOriginAttributeValue crossOrigin;
    const bool shouldLoad;
    const bool isHTTPS;
    const bool isCrossOrigin;
  } cases[] = {
      {"http://example.com/", CrossOriginAttributeNotSet, true, false, false},
      {"https://example.com/", CrossOriginAttributeNotSet, true, true, false},
      {"http://example.com/", CrossOriginAttributeAnonymous, true, false, true},
      {"//example.com/", CrossOriginAttributeNotSet, true, false, false},
      {"http://example.com/", CrossOriginAttributeNotSet, false, false, false},
  };

  // Test the cases with a single header
  for (const auto& testCase : cases) {
    std::unique_ptr<DummyPageHolder> dummyPageHolder =
        DummyPageHolder::create(IntSize(500, 500));
    Persistent<MockLinkLoaderClient> loaderClient =
        MockLinkLoaderClient::create(testCase.shouldLoad);
    LinkLoader* loader = LinkLoader::create(loaderClient.get());
    KURL hrefURL =
        KURL(KURL(ParsedURLStringTag(), String("http://example.com")),
             testCase.href);
    NetworkHintsMock networkHints;
    loader->loadLink(LinkRelAttribute("preconnect"), testCase.crossOrigin,
                     String(), String(), String(), ReferrerPolicyDefault,
                     hrefURL, dummyPageHolder->document(), networkHints);
    EXPECT_EQ(testCase.shouldLoad, networkHints.didPreconnect());
    EXPECT_EQ(testCase.isHTTPS, networkHints.isHTTPS());
    EXPECT_EQ(testCase.isCrossOrigin, networkHints.isCrossOrigin());
  }
}
开发者ID:mirror,项目名称:chromium,代码行数:34,代码来源:LinkLoaderTest.cpp

示例3: testMQEvaluator

void testMQEvaluator(TestCase* testCases,
                     const MediaQueryEvaluator& mediaQueryEvaluator) {
  Persistent<MediaQuerySet> querySet = nullptr;
  for (unsigned i = 0; testCases[i].input; ++i) {
    querySet = MediaQuerySet::create(testCases[i].input);
    EXPECT_EQ(testCases[i].output, mediaQueryEvaluator.eval(querySet.get()));
  }
}
开发者ID:mirror,项目名称:chromium,代码行数:8,代码来源:MediaQueryEvaluatorTest.cpp

示例4: DummyClient

TEST(RawResourceTest, RemoveClientDuringCallback)
{
    Resource* raw = RawResource::create(ResourceRequest("data:text/html,"), Resource::Raw);

    // Create a non-null response.
    ResourceResponse response = raw->response();
    response.setURL(KURL(ParsedURLString, "http://600.613/"));
    raw->setResponse(response);
    raw->finish();
    EXPECT_FALSE(raw->response().isNull());

    Persistent<DummyClient> dummyClient = new DummyClient();
    Persistent<RemovingClient> removingClient = new RemovingClient(dummyClient.get());
    raw->addClient(dummyClient);
    raw->addClient(removingClient);
    testing::runPendingTasks();
    EXPECT_FALSE(raw->hasClientsOrObservers());
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:18,代码来源:RawResourceTest.cpp

示例5: runIFrameTest

void TouchActionTest::runIFrameTest(std::string file) {
  TouchActionTrackingWebViewClient client;

  WebView* webView = setupTest(file, client);
  WebFrame* curFrame = webView->mainFrame()->firstChild();
  ASSERT_TRUE(curFrame);

  for (; curFrame; curFrame = curFrame->nextSibling()) {
    // Oilpan: see runTouchActionTest() comment why these are persistent
    // references.
    Persistent<Document> contentDoc =
        static_cast<Document*>(curFrame->document());
    runTestOnTree(contentDoc.get(), webView, client);
  }

  // Explicitly reset to break dependency on locally scoped client.
  m_webViewHelper.reset();
}
开发者ID:mirror,项目名称:chromium,代码行数:18,代码来源:TouchActionTest.cpp

示例6: runTouchActionTest

void TouchActionTest::runTouchActionTest(std::string file) {
  TouchActionTrackingWebViewClient client;

  // runTouchActionTest() loads a document in a frame, setting up a
  // nested message loop. Should any Oilpan GC happen while it is in
  // effect, the implicit assumption that we're outside any event
  // loop (=> there being no pointers on the stack needing scanning)
  // when that GC strikes will no longer hold.
  //
  // To ensure that the references on the stack are also traced, we
  // turn them into persistent, stack allocated references. This
  // workaround is sufficient to handle this artificial test
  // scenario.
  WebView* webView = setupTest(file, client);

  Persistent<Document> document =
      static_cast<Document*>(webView->mainFrame()->document());
  runTestOnTree(document.get(), webView, client);

  // Explicitly reset to break dependency on locally scoped client.
  m_webViewHelper.reset();
}
开发者ID:mirror,项目名称:chromium,代码行数:22,代码来源:TouchActionTest.cpp

示例7: memoryCache

TEST(RawResourceTest, RevalidationSucceededUpdateHeaders)
{
    Resource* resource = RawResource::create(ResourceRequest("data:text/html,"), Resource::Raw);
    ResourceResponse response;
    response.setHTTPStatusCode(200);
    response.addHTTPHeaderField("keep-alive", "keep-alive value");
    response.addHTTPHeaderField("expires", "expires value");
    response.addHTTPHeaderField("last-modified", "last-modified value");
    response.addHTTPHeaderField("proxy-authenticate", "proxy-authenticate value");
    response.addHTTPHeaderField("proxy-connection", "proxy-connection value");
    response.addHTTPHeaderField("x-custom", "custom value");
    resource->responseReceived(response, nullptr);
    resource->finish();
    memoryCache()->add(resource);

    // Simulate a successful revalidation.
    resource->setRevalidatingRequest(ResourceRequest("data:text/html,"));

    // Validate that these headers pre-update.
    EXPECT_EQ("keep-alive value", resource->response().httpHeaderField("keep-alive"));
    EXPECT_EQ("expires value", resource->response().httpHeaderField("expires"));
    EXPECT_EQ("last-modified value", resource->response().httpHeaderField("last-modified"));
    EXPECT_EQ("proxy-authenticate value", resource->response().httpHeaderField("proxy-authenticate"));
    EXPECT_EQ("proxy-authenticate value", resource->response().httpHeaderField("proxy-authenticate"));
    EXPECT_EQ("proxy-connection value", resource->response().httpHeaderField("proxy-connection"));
    EXPECT_EQ("custom value", resource->response().httpHeaderField("x-custom"));

    Persistent<DummyClient> client = new DummyClient;
    resource->addClient(client.get());

    // Perform a revalidation step.
    ResourceResponse revalidatingResponse;
    revalidatingResponse.setHTTPStatusCode(304);
    // Headers that aren't copied with an 304 code.
    revalidatingResponse.addHTTPHeaderField("keep-alive", "garbage");
    revalidatingResponse.addHTTPHeaderField("expires", "garbage");
    revalidatingResponse.addHTTPHeaderField("last-modified", "garbage");
    revalidatingResponse.addHTTPHeaderField("proxy-authenticate", "garbage");
    revalidatingResponse.addHTTPHeaderField("proxy-connection", "garbage");
    // Header that is updated with 304 code.
    revalidatingResponse.addHTTPHeaderField("x-custom", "updated");
    resource->responseReceived(revalidatingResponse, nullptr);

    // Validate the original response.
    EXPECT_EQ(200, resource->response().httpStatusCode());

    // Validate that these headers are not updated.
    EXPECT_EQ("keep-alive value", resource->response().httpHeaderField("keep-alive"));
    EXPECT_EQ("expires value", resource->response().httpHeaderField("expires"));
    EXPECT_EQ("last-modified value", resource->response().httpHeaderField("last-modified"));
    EXPECT_EQ("proxy-authenticate value", resource->response().httpHeaderField("proxy-authenticate"));
    EXPECT_EQ("proxy-authenticate value", resource->response().httpHeaderField("proxy-authenticate"));
    EXPECT_EQ("proxy-connection value", resource->response().httpHeaderField("proxy-connection"));
    EXPECT_EQ("updated", resource->response().httpHeaderField("x-custom"));

    memoryCache()->remove(resource);

    resource->removeClient(client);
    EXPECT_FALSE(resource->hasClientsOrObservers());
    EXPECT_FALSE(client->called());
    EXPECT_EQ(0u, client->data().size());
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:62,代码来源:RawResourceTest.cpp


注:本文中的Persistent::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。